예제 #1
0
def deadchar(rpg):
    """Deal with character death"""
    send_to_console("What would you like to do? Options: "\
        "Generate (a new character), Load, Quit")
    dothis = choose_from_list("Dead> ", ["Generate", "Load", "Quit"],
        character=rpg.character, rand=False, allowed=["sheet", "help"])
    if dothis == "Quit":
        confirm_quit()
        deadchar(rpg)
        return
    if dothis == "Load":
        rpg = load(rpg)
        if not rpg:
            send_to_console("I'm sorry, that didn't work... maybe you deleted " \
                "the save file? Anyway...")
            deadchar(rpg)
            return
        else:
            send_to_console("Game successfully loaded!")
            send_to_console("You begin in the town square.")
            rpg.character.tellchar()
            rpg.destination("town")
            town(rpg)
            return
    if dothis == "Generate":
        rpg = generate(rpg)
        send_to_console("You begin in the town square.")
        town(rpg)
        return
예제 #2
0
def deadchar(rpg):
    """Deal with character death"""
    print "What would you like to do? Options: "\
        "Generate (a new character), Load, Quit"
    dothis = choose_from_list("Dead> ", ["Generate", "Load", "Quit"],
                              character=rpg.character,
                              rand=False,
                              allowed=["sheet", "help"])
    if dothis == "Quit":
        confirm_quit()
        deadchar(rpg)
        return
    if dothis == "Load":
        rpg = load(rpg)
        if not rpg:
            print "I'm sorry, that didn't work... maybe you deleted " \
                "the save file? Anyway..."
            deadchar(rpg)
            return
        else:
            print "Game successfully loaded!"
            print "You begin in the town square."
            rpg.character.tellchar()
            rpg.destination("town")
            town(rpg)
            return
    if dothis == "Generate":
        rpg = generate(rpg)
        print "You begin in the town square."
        town(rpg)
        return
예제 #3
0
def main():
    """Initialize and start the game session"""
    print logo
    print textwrap.fill("Welcome to Percival's Quest! This is a solo random " \
        "dungeoncrawl rpg written in python by the ever-resourceful (and " \
        "extremely humble) sirpercival.")
    player_name = raw_input(color.BOLD + "Please enter your player name> " +
                            color.END)
    msg = "Welcome, " + player_name + "!"
    rpg_instance = pqr.PQ_RPG(player_name)
    newgame = False
    temp_rpg = load(rpg_instance)
    if temp_rpg:
        msg += " You currently have a game saved. Would you like to load it?"
        print msg
        loadit = raw_input("Load (y/n)> ")
        if loadit.lower() in ["y", "yes", "load"]:
            rpg_instance = temp_rpg
            del temp_rpg
            print "Game successfully loaded."
            rpg_instance.character.tellchar()
        else:
            newgame = True
    else:
        print msg + " You don't have a character saved..."
        newgame = True
    if newgame:
        rpg_instance = generate(rpg_instance)
    msg = "You begin in the town square. \n"
    msg += "(Please note that at almost any prompt, you can choose Sheet " \
        "to look at your charsheet, Equip to change your equipment, Help " \
        "to enter the help library, or Quit to quit.)"
    print textwrap.fill(msg)
    msg = "To the East is your humble abode and warm bed; " \
        "to the North, the General Store where various and sundry goods " \
        "may be purchased; to the West, the Questhall where the mayor " \
        "makes his office; to the Northwest, the local Shrine to the " \
        "Unknowable Gods; and to the South lie the gates of the city, " \
        "leading out to the Dungeon."
    print textwrap.fill(msg)
    town(rpg_instance)
예제 #4
0
def main():
    """Initialize and start the game session"""
    print logo
    print textwrap.fill("Welcome to Percival's Quest! This is a solo random " \
        "dungeoncrawl rpg written in python by the ever-resourceful (and " \
        "extremely humble) sirpercival.")
    player_name = raw_input(color.BOLD+"Please enter your player name> "+
        color.END)
    msg = "Welcome, "+player_name+"!"
    rpg_instance = pqr.PQ_RPG(player_name)
    newgame = False
    temp_rpg = load(rpg_instance)
    if temp_rpg:
        msg += " You currently have a game saved. Would you like to load it?"
        print msg
        loadit = raw_input("Load (y/n)> ")
        if loadit.lower() in ["y", "yes", "load"]:
            rpg_instance = temp_rpg
            del temp_rpg
            print "Game successfully loaded."
            rpg_instance.character.tellchar()
        else:
            newgame = True
    else:
        print msg + " You don't have a character saved..."
        newgame = True
    if newgame:
        rpg_instance = generate(rpg_instance)
    msg = "You begin in the town square. \n"
    msg += "(Please note that at almost any prompt, you can choose Sheet " \
        "to look at your charsheet, Equip to change your equipment, Help " \
        "to enter the help library, or Quit to quit.)"
    print textwrap.fill(msg)
    msg = "To the East is your humble abode and warm bed; " \
        "to the North, the General Store where various and sundry goods " \
        "may be purchased; to the West, the Questhall where the mayor " \
        "makes his office; to the Northwest, the local Shrine to the " \
        "Unknowable Gods; and to the South lie the gates of the city, " \
        "leading out to the Dungeon."
    print textwrap.fill(msg)
    town(rpg_instance)