Ejemplo n.º 1
0
def wait(string):
    if string!="":    
        try:
            times=int(string)-1
            for i in range(times):
                updater.updateAll()
                createWorld(True)
            print("You waited "+str(times+1)+"turns.")
        except ValueError:
            print("Invalid number!")
        finally:
            enter()
    return [True,True]
Ejemplo n.º 2
0
startingMessage()
while playing and player.alive:
    printSituation()
    situation=[False,False]
    while not situation[0]:
        situation=[True,False]
        situation=MainMenu.runMenu()
        if situation[0] == "E" and situation[1] == "ND":
            print("Thanks for playing!")
            playing = False
            situation=[True,True]
        if player.health<=0:
            player.alive=False
            situation[0]=True
        elif situation[1] == True:
            updater.updateAll()
            createWorld(False)
    if not player.alive:
        commandSuccess = False
        while commandSuccess == False:
            answer = input("Oh dear, you are dead! Respawn in the hospital wing? ")
            if answer.lower() == "yes":
                player.alive = True
                player.health = player.maxhealth
                player.location = Room.getRoomByName("Hospital Wing")
                commandSuccess = True
            elif answer.lower() == "no":
                exit()
                commandSuccess = True
            else:
                print()
Ejemplo n.º 3
0
            targetName = command[7:]
            target = player.location.getItemByName(targetName)
            if target != False:
                player.pickup(target)
            else:
                print("No such item.")
                commandSuccess = False
        elif commandWords[0].lower() == "inventory":
            player.showInventory()        
        elif commandWords[0].lower() == "help":
            showHelp()
        elif commandWords[0].lower() == "exit":
            playing = False
        elif commandWords[0].lower() == "attack":
            targetName = command[7:]
            target = player.location.getMonsterByName(targetName)
            if target != False:
                player.attackMonster(target)
            else:
                print("No such monster.")
                commandSuccess = False
        else:
            print("Not a valid command")
            commandSuccess = False
    if timePasses == True:
        updater.updateAll()