Пример #1
0
def render_room_1():
    session.dungeon = "01"
    session.room = "01"
    screen.clear_screen()
    screen.print_general_screen()
    screen.print_room_description(
        "You wake up in a dark and dry room. You look around and it's looks\n"
        "like a cell. Right in front of you, close to the cell bars, there is\n"
        "a guard, drop dead"
    )
    screen.print_room_options([
        "Scream for help",
        "Check the guard's body"
    ])

    option = ""
    while option != "q":
        option = raw_input("Choose an option (q to quit): ")
        if option == "1":
            screen.clear_screen()
            screen.print_room_notice("No one listens to you, you are on your own")
            render_room_1()
        elif option == "2":
            screen.clear_screen()
            screen.print_room_notice(
                "You find the cell key in his pocket. You leave the cell"
            )
            render_room_2()
        elif option == "q":
            screen.print_game_over()
        else:
            screen.print_error("Choose a valid option")
Пример #2
0
def render_room_3():
    session.dungeon = "01"
    session.room = "03"
    screen.clear_screen()
    screen.print_general_screen()
    screen.print_room_description(
        "You enter a messy and dry room, there are an interesting desk in the\n"
        "corner, covered with papers and a shiny drawer"
    )
    screen.print_room_options([
        "Check the drawer",
        "Leave the room"
    ])

    option = ""
    while option != "q":
        option = raw_input("Choose an option (q to quit): ")
        if option == "1":
            screen.clear_screen()
            if session.player_found_gp_in_room_2:
                screen.print_room_notice("The drawer is empty")
            else:
                session.player_gp = session.player_gp + 2
                session.player_found_gp_in_room_2 = True
                screen.print_room_notice("You found 2GP")
            render_room_3()
        elif option == "2":
            render_room_2()
        elif option == "q":
            screen.print_game_over()
        else:
            screen.print_error("Choose a valid option")
Пример #3
0
def render_room_5():
    session.dungeon = "01"
    session.room = "05"
    screen.clear_screen()
    screen.print_general_screen()
    screen.print_room_description(
        "After a heat battle, you still have energy to run. At the end of the\n"
        "hall, there is a dark corridor. When you enter it, you notice that\n"
        "part of the floor looks different"
    )
    screen.print_room_options([
        "Check for traps",
        "Run like there is no tomorrow"
    ])

    option = ""
    while option != "q":
        option = raw_input("Choose an option (q to quit): ")
        if option == "1":
            screen.clear_screen()
            screen.print_room_notice(
                "You find a trap, a clumsy deep hole full of pythons. You jump "
                "over it"
            )
            screen.print_game_over()
        elif option == "2":
            screen.clear_screen()
            screen.print_room_notice(
                "You fall in a deep hole and get bitten by the pythons"
            )
            screen.print_game_over()
        elif option == "q":
            screen.print_game_over()
        else:
            screen.print_error("Choose a valid option")
Пример #4
0
def render_room_2():
    session.dungeon = "01"
    session.room = "02"
    screen.clear_screen()
    screen.print_general_screen()
    screen.print_room_description(
        "This look like a corridor full of cells. There is an open door on\n"
        "the right and a long corridor on the left"
    )
    screen.print_room_options([
        "Enter the open door on the right",
        "Run through the corridor on the left"
    ])

    option = ""
    while option != "q":
        option = raw_input("Choose an option (q to quit): ")
        if option == "1":
            render_room_3()
        elif option == "2":
            render_room_4()
        elif option == "q":
            screen.print_game_over()
        else:
            screen.print_error("Choose a valid option")
Пример #5
0
def render_room_3():
    session.dungeon = "01"
    session.room = "03"
    screen.clear_screen()
    screen.print_general_screen()
    screen.print_room_description(
        "You enter a messy and dry room, there are an interesting desk in the\n"
        "corner, covered with papers and a shiny drawer")
    screen.print_room_options(["Check the drawer", "Leave the room"])

    option = ""
    while option != "q":
        option = raw_input("Choose an option (q to quit): ")
        if option == "1":
            screen.clear_screen()
            if session.player_found_gp_in_room_2:
                screen.print_room_notice("The drawer is empty")
            else:
                session.player_gp = session.player_gp + 2
                session.player_found_gp_in_room_2 = True
                screen.print_room_notice("You found 2GP")
            render_room_3()
        elif option == "2":
            render_room_2()
        elif option == "q":
            screen.print_game_over()
        else:
            screen.print_error("Choose a valid option")
Пример #6
0
def render_room_1():
    session.dungeon = "01"
    session.room = "01"
    screen.clear_screen()
    screen.print_general_screen()
    screen.print_room_description(
        "You wake up in a dark and dry room. You look around and it's looks\n"
        "like a cell. Right in front of you, close to the cell bars, there is\n"
        "a guard, drop dead")
    screen.print_room_options(["Scream for help", "Check the guard's body"])

    option = ""
    while option != "q":
        option = raw_input("Choose an option (q to quit): ")
        if option == "1":
            screen.clear_screen()
            screen.print_room_notice(
                "No one listens to you, you are on your own")
            render_room_1()
        elif option == "2":
            screen.clear_screen()
            screen.print_room_notice(
                "You find the cell key in his pocket. You leave the cell")
            render_room_2()
        elif option == "q":
            screen.print_game_over()
        else:
            screen.print_error("Choose a valid option")
Пример #7
0
def render_room_5():
    session.dungeon = "01"
    session.room = "05"
    screen.clear_screen()
    screen.print_general_screen()
    screen.print_room_description(
        "After a heat battle, you still have energy to run. At the end of the\n"
        "hall, there is a dark corridor. When you enter it, you notice that\n"
        "part of the floor looks different")
    screen.print_room_options(
        ["Check for traps", "Run like there is no tomorrow"])

    option = ""
    while option != "q":
        option = raw_input("Choose an option (q to quit): ")
        if option == "1":
            screen.clear_screen()
            screen.print_room_notice(
                "You find a trap, a clumsy deep hole full of pythons. You jump "
                "over it")
            screen.print_game_over()
        elif option == "2":
            screen.clear_screen()
            screen.print_room_notice(
                "You fall in a deep hole and get bitten by the pythons")
            screen.print_game_over()
        elif option == "q":
            screen.print_game_over()
        else:
            screen.print_error("Choose a valid option")
Пример #8
0
def render_room_4():
    session.dungeon = "01"
    session.room = "04"
    screen.clear_screen()
    screen.print_general_screen()
    screen.print_room_description(
        "You enter the main hall. You fell a huge shade coming from nowhere\n"
        "weaving a big axe at you... TIME TO BATTLE!")
    raw_input("Press any key to continue...")
    battles.render_battle_1()
Пример #9
0
def render_room_4():
    session.dungeon = "01"
    session.room = "04"
    screen.clear_screen()
    screen.print_general_screen()
    screen.print_room_description(
        "You enter the main hall. You fell a huge shade coming from nowhere\n"
        "weaving a big axe at you... TIME TO BATTLE!"
    )
    raw_input("Press any key to continue...")
    battles.render_battle_1()
Пример #10
0
def render_room_2():
    session.dungeon = "01"
    session.room = "02"
    screen.clear_screen()
    screen.print_general_screen()
    screen.print_room_description(
        "This look like a corridor full of cells. There is an open door on\n"
        "the right and a long corridor on the left")
    screen.print_room_options([
        "Enter the open door on the right",
        "Run through the corridor on the left"
    ])

    option = ""
    while option != "q":
        option = raw_input("Choose an option (q to quit): ")
        if option == "1":
            render_room_3()
        elif option == "2":
            render_room_4()
        elif option == "q":
            screen.print_game_over()
        else:
            screen.print_error("Choose a valid option")
Пример #11
0
def render_battle_1():
    session.monster_name = "Ugly Orc"
    turn = "player"
    player_defense = 0
    monster_defense = 0
    time_to_battle = session.monster_hp > 0 and session.player_hp > 0
    while time_to_battle:
        screen.clear_screen()
        screen.print_general_screen()
        screen.print_battle_screen()
        if turn == "player":
            dice = utils.rolls_dice()
            option = ""
            while option != "q":
                screen.print_battle_options(["Attack", "Defend"])
                option = raw_input("Choose an option (q to quit): ")
                if option == "1":
                    if monster_defense > 0:
                        damage = (dice + session.player_ap) - (
                            session.monster_dp + monster_defense)
                    else:
                        damage = (dice +
                                  session.player_ap) - session.monster_dp
                    if damage < 0:
                        damage = 0
                    screen.clear_screen()
                    screen.print_general_screen()
                    screen.print_battle_screen()
                    screen.print_battle_info(
                        "Player attacks, rolls %s, dealing %s of damage" %
                        (dice, damage))
                    raw_input("Press any key to continue...")
                    session.monster_hp = session.monster_hp - damage
                    player_defense = 0
                    turn = "monster"
                    break
                elif option == "2":
                    player_defense = dice + session.player_dp
                    screen.clear_screen()
                    screen.print_general_screen()
                    screen.print_battle_screen()
                    screen.print_battle_info(
                        "Player defends, rolls %s, getting %s of defense" %
                        (dice, player_defense))
                    raw_input("Press any key to continue...")
                    turn = "monster"
                    break
                else:
                    screen.print_error("Choose a valid option")
        elif turn == "monster":
            dice = utils.rolls_dice()
            option = utils.choose_one(["1", "2"])
            if option == "1":
                if player_defense > 0:
                    damage = (dice + session.monster_ap) - (session.player_dp +
                                                            player_defense)
                else:
                    damage = (dice + session.monster_ap) - session.player_dp
                if damage < 0:
                    damage = 0
                screen.clear_screen()
                screen.print_general_screen()
                screen.print_battle_screen()
                screen.print_battle_info(
                    "Monster attacks, rolls %s, dealing %s of damage" %
                    (dice, damage))
                raw_input("Press any key to continue...")
                session.player_hp = session.player_hp - damage
                monster_defense = 0
                turn = "player"
            elif option == "2":
                monster_defense = dice + session.monster_dp
                screen.clear_screen()
                screen.print_general_screen()
                screen.print_battle_screen()
                screen.print_battle_info(
                    "Monster defends, rolls %s, getting %s of defense" %
                    (dice, monster_defense))
                raw_input("Press any key to continue...")
                turn = "player"
            else:
                screen.print_error("Unknown monster action")
        else:
            screen.print_error("Unknown turn")

        if session.monster_hp <= 0:
            screen.print_room_notice("You won!")
            screen.print_room_notice("You found %sGP" % session.monster_gp)
            session.player_gp = session.player_gp + session.monster_gp
            rooms.render_room_5()
        elif session.player_hp <= 0:
            screen.print_room_notice("You died!")
            screen.print_game_over()
        else:
            continue
Пример #12
0
def render_battle_1():
    session.monster_name = "Ugly Orc"
    turn = "player"
    player_defense = 0
    monster_defense = 0
    time_to_battle = session.monster_hp > 0 and session.player_hp > 0
    while time_to_battle:
        screen.clear_screen()
        screen.print_general_screen()
        screen.print_battle_screen()
        if turn == "player":
            dice = utils.rolls_dice()
            option = ""
            while option != "q":
                screen.print_battle_options([
                    "Attack",
                    "Defend"
                ])
                option = raw_input("Choose an option (q to quit): ")
                if option == "1":
                    if monster_defense > 0:
                        damage = (dice + session.player_ap) - (session.monster_dp + monster_defense)
                    else:
                        damage = (dice + session.player_ap) - session.monster_dp
                    if damage < 0:
                        damage = 0
                    screen.clear_screen()
                    screen.print_general_screen()
                    screen.print_battle_screen()
                    screen.print_battle_info(
                        "Player attacks, rolls %s, dealing %s of damage" % (dice, damage)
                    )
                    raw_input("Press any key to continue...")
                    session.monster_hp = session.monster_hp - damage
                    player_defense = 0
                    turn = "monster"
                    break
                elif option == "2":
                    player_defense = dice + session.player_dp
                    screen.clear_screen()
                    screen.print_general_screen()
                    screen.print_battle_screen()
                    screen.print_battle_info(
                        "Player defends, rolls %s, getting %s of defense" % (dice, player_defense)
                    )
                    raw_input("Press any key to continue...")
                    turn = "monster"
                    break
                else:
                    screen.print_error("Choose a valid option")
        elif turn == "monster":
            dice = utils.rolls_dice()
            option = utils.choose_one(["1", "2"])
            if option == "1":
                if player_defense > 0:
                    damage = (dice + session.monster_ap) - (session.player_dp + player_defense)
                else:
                    damage = (dice + session.monster_ap) - session.player_dp
                if damage < 0:
                    damage = 0
                screen.clear_screen()
                screen.print_general_screen()
                screen.print_battle_screen()
                screen.print_battle_info(
                    "Monster attacks, rolls %s, dealing %s of damage" % (dice, damage)
                )
                raw_input("Press any key to continue...")
                session.player_hp = session.player_hp - damage
                monster_defense = 0
                turn = "player"
            elif option == "2":
                monster_defense = dice + session.monster_dp
                screen.clear_screen()
                screen.print_general_screen()
                screen.print_battle_screen()
                screen.print_battle_info(
                    "Monster defends, rolls %s, getting %s of defense" % (dice, monster_defense)
                )
                raw_input("Press any key to continue...")
                turn = "player"
            else:
                screen.print_error("Unknown monster action")
        else:
            screen.print_error("Unknown turn")

        if session.monster_hp <= 0:
            screen.print_room_notice("You won!")
            screen.print_room_notice("You found %sGP" % session.monster_gp)
            session.player_gp = session.player_gp + session.monster_gp
            rooms.render_room_5()
        elif session.player_hp <= 0:
            screen.print_room_notice("You died!")
            screen.print_game_over()
        else:
            continue