Example #1
0
def startingMessage():
    clear()
    print("Potions today was interesting - you learned about Felix Felicis,")
    print("or 'liquid luck'.  You've always been sort of clumsy, but this would change that.")
    print("This would change everything.  People would look up to Neville Longbottom.")
    print("It's supposed to be terribly difficult to make though.")
    print()
    enter()
    print()
    print("You wonder if Hermione could help.")
    print()
    enter()
Example #2
0
def printSituation():
    clear()
    print(player.location.desc)
    print()
    if player.location.hasMonsters():
        print("This room contains the following monsters:")
        for m in player.location.monsters:
            print(m.name)
        print()
    if player.location.hasNPCs():
        print("This room has the following NPCs:")
        for n in player.location.npcs:
            print(n.name)
        print()
    if player.location.hasItems():
        print("This room contains the following items:")
        player.location.showItems()
        print()
    print("You can go in the following directions:")
    for e in player.location.exitNames():
        print(e)
    print()
Example #3
0
 def runHelp(self,string):
     clear()
     page=1
     length=len(self.helplist)
     if string=="":
         page = 1
     elif not numcheck(string):
         print("Invalid page number, displaying page 1")
         page=1
     elif int(num(string))==num(string):
         if num(string)<1:
             page=1
             print("Invalid page number, displaying page 1")
         else:
             page=num(string)
     if not numcheck(string) and page!=1:
         print("Invalid page number, displaying page 1")
         page=1
     elif page>len(self.helplist)//self.itemsperpage+1:
         print("Page out of range, displaying page 1")
         page=1
     for i in range((page-1)*self.itemsperpage,min(page*self.itemsperpage,len(self.helplist))):
         if self.expectedinput[i]==None:
             expected=""
         else:
             expected=" "+self.expectedinput[i]
         if self.abbrevlist[i]==None:
             abbrev=""
         else:
             abbrev="("+self.abbrevlist[i]+")"
         print(self.displaylist[i]+abbrev+expected+" -- "+self.helplist[i])
     pagecount=int(len(self.helplist)/self.itemsperpage)-len(self.helplist)/self.itemsperpage
     if pagecount!=0:
         pagecount=1
     pagecount+=len(self.helplist)//self.itemsperpage
     print("Page "+str(page)+" of "+str(pagecount))
     enter()
     return [False,False]
Example #4
0
def victory():
    clear()
    print("You wait six months for it to brew.")
    print()
    enter()
    print("You wait.")
    print()
    enter()
    print("And wait.")
    print()
    enter()
    print("And wait.")
    print()
    enter()
    print("Yay! It's done.")
    print()
    enter()
    print("You take a sip.")
    print()
    enter()
    print("Feeling lucky?")
    print()
    enter()
    exit("END")
Example #5
0
def inspect(string):
    target = player.location.getItemByName(string)
    if target in player.location.items:
        x = target.describe() #list of item objects
        if target.container: #if inspecting a container
            if target.lock==True:
                query=input("The "+target.name+" is locked.  Use a key to unlock it?")
                if query.lower()=="yes":
                    for i in player.items:
                        if target.unlock(i):
                            player.items.remove(i)
                    if target.lock==True:
                        print("You have no keys!")
                        enter()
                        return [True,False]
                    else:
                        print(target.name+" is unlocked now!")
                        enter()
                        return [True, True]
                else:
                    return [True, False]
            else:
                totalWeight = 0
                for i in x:
                    totalWeight += i.weight
                query=input("Type an item name to pick up an item, or 'all' to attempt to pick up all of them. ")
                if query.lower()=="all":    
                    if player.getWeight()+totalWeight<=player.invmaxsize:
                        while len(x)>0:                     #Using a for loop was causing issues, as we're modifying the size of the list within this loop
                            #related to q2, step 3
                            if x[0].name == "Squill Seed" and quest.q2step3finished == False:
                                quest.q2step3finished = True
                                quest.q2.nextStep()
                            #related to q3, step 3
                            if x[0].name == "Occamy Eggshell" and quest.q3step3finished == False:
                                quest.q3step3finished = True
                                quest.q3.endQuest()
                                quest.q4.startQuest()
                            #related to q5, step 3
                            if x[0].name == "Murtlap Tentacle" and quest.q5step3finished == False:
                                quest.q5step3finished = True
                                quest.q5.endQuest()
                                quest.q6.startQuest()
                                clear()
                                print("Oh no! Umbridge removes Hagrid from school grounds! Looks like you'll have to ask someone else about ashwinder eggs.")
                                print()
                                enter()
                            player.items.append(x[0])
                            x[0].loc = player
                            x.remove(x[0])
                    else:
                        print("Not enough space in your inventory.")
                elif query.lower()!="":
                    itemdict=target.listItems()
                    inTheBox=False
                    for i in x:
                        if query.lower()==i.name.lower():
                            inTheBox=True
                            if i.weight+player.getWeight()<=player.invmaxsize:
                                if itemdict[i.name]==1:
                                    query=1
                                else:
                                    try:
                                        query=int(input("How many? "))
                                    except ValueError:
                                        print("Invalid input.")
                                        break
                                if query<=0:
                                    break
                                elif query>itemdict[i.name]:
                                    query=itemdict[i.name]
                                    print("Not that many items in the container! Attempting to add "+str(query)+".")
                                elif query==1:
                                    if i.name == "Squill Seed" and quest.q2step3finished == False:
                                        quest.q2step3finished = True
                                        quest.q2.nextStep()
                                    if i.name == "Occamy Eggshell" and quest.q3step3finished == False:
                                        quest.q3step3finished = True
                                        quest.q3.endQuest()
                                        quest.q4.startQuest()
                                    if i.name == "Murtlap Tentacle" and quest.q5step3finished == False:
                                        quest.q5step3finished = True
                                        quest.q5.endQuest()
                                        quest.q6.startQuest()
                                    target.removeItem(i)
                                    player.items.append(i)
                                else:
                                    freeweight=player.invmaxsize-player.getWeight()
                                    toAdd=query
                                    if toAdd*i.weight>freeweight:
                                        toAdd=freeweight//i.weight
                                    while toAdd>0:
                                        if i.name == "Squill Seed" and quest.q2step3finished == False:
                                            quest.q2step3finished = True
                                            quest.q2.nextStep()
                                        if i.name == "Occamy Eggshell" and quest.q3step3finished == False:
                                            quest.q3step3finished = True
                                            quest.q3.endQuest()
                                            quest.q4.startQuest()
                                        target.removeItem(i)
                                        player.items.append(i)
                                        toAdd-=1
                            break
                    if inTheBox==False:
                        print("Not in the container.")
                elif query.lower()=="no" or query.lower()=="":
                    return [True,False]
        return [True,False]
    else:
        print("Can't inspect.")
        enter()
        return [False,False]