示例#1
0
    def search(noun):

        if noun == "bodies":
            LtlBell.log = "Battlefield bodies did not have wapons... Currious."
            LtlBell.active = True
            exp = 1
            player.lvl = get_object.Level(exp)
            return """\n\n\tThat's strange... There are no weapons here...
\tThese warriors should have weapons!\n\tYou gain 1 experience point\n\n"""

        if noun == "sky":
            return "\n\n\tYou look to the gods for answers and find none...\n\n"

        elif noun == "ground":

            yes = util.yesOrNo(
                "\n\nYou find a stick on the ground,\nDo you want to use it as a weapon? (Y/N) >> "
            )
            if yes:
                weapon = get_object.gameWeapon("stick")
                if not weapon:
                    return "\n\n" + "-" * 90 + "\n\n"
                else:
                    player.att_die1 = weapon
                    player.weap1 = "stick"
                    exp = 6
                    player.lvl = get_object.Level(exp)
                    return "\n\nI guess this stick will have to do for now.\n\t\tYou gain 6 experience ponts\n\n" + "-" * 90 + "\n"

            else:
                yes = util.yesOrNo(
                    "\nDo you want to use your fists as a weapon? (Y/N) >> ")
                if yes:
                    weapon = get_object.gameWeapon("fist")
                    if not weapon:
                        return "\n\n" + "-" * 90 + "\n\n"
                    else:
                        player.att_die1 = weapon
                        player.weap1 = "fist"
                        exp = 5
                        player.lvl = get_object.level(exp)
                        return "\n\nI guess i'll have to use my fists for now.\n\t\tYou gain 5 experience points\n\n-" + "-" * 90 + "\n"

                else:
                    return "\n\n" + "-" * 90 + "\n\n"
        else:
            player.att_die = 0
            return '\n\nYou cannot search "{}" \n\n'.format(
                noun) + "-" * 90 + "\n"
示例#2
0
 def dice(self):
     print("You chose: %s, for 1-%i damage." % (self.name, self.att_die))
     affirm = util.yesOrNo("Is this correct? >> ")
     if affirm:
         return self.att_die
     else:
         return False
示例#3
0
 def get_input():
     
           
     command = input("\nWhat do you want to do? [hit] [examine] [run] [say]\n\nCommand >> ").split()
     verb_word = command[0]
     
     run = False
     if verb_word == "run": # Exit game and run away
         run = util.yesOrNo("\nYou want to " + verb_word + ".\nAre you sure? (Y/N) >> ")
         if run == True:
             print("\n\t\tYou run away!\n")
             return True
         else:
             return False
         
     elif verb_word in verb_dict:
         verb = verb_dict[verb_word]
     else:
         print("Unknown verb {}" .format(verb_word))
         return False
     
     if len(command) >= 2:
         noun_word = command[1]
         print (verb(noun_word))
     else:
         print(verb("nothing"))
     if goblin1.health <= 0 and orc1.health <=0:
         run = True
         print("\n\t\tYou win the battle!")
         return run
     elif Tak.health <= 0:
         run = True
         print("You lost the battle!")
         return run      
     return run
示例#4
0
    def get_input():
        print("""\n\t\t\t\t  THE ADVENTURES OF
\t\t\t\t\tTAKEZO!

\t\t\t Based on Eiji Yoshikawa's "Musashi"\n\n\n""")

        yes = util.yesOrNo("Do you want to start the adventure? (Y/N) >> ")
        print("\n\n" + "=" * 90 + "\n\n")
        time.sleep(0.5)
        if yes:
            return True
        else:
            return False
示例#5
0
def getName():
    tempName = ""
    while True:
        tempName = nameInput("\nWhat is your name? >> ")

        if len(tempName) < 1:
            continue

        yes = util.yesOrNo(tempName + ", is that your name? (Y/N) >> ")

        if yes:
            return tempName
        else:
            continue
示例#6
0
def getName():
    tempName = ""
    while True:
        tempName = nameInput(
            "\nWhat is your name? >> "
        )  # go to 'nameInput' (line 3) and recieve user name

        if len(tempName) <= 1:
            print("Name is too short...")
            continue

        yes = util.yesOrNo(tempName + ", is that your name? (Y/N) >> ")

        if yes:
            return tempName  # Returns players name to intro.py line 59 - getname()
        else:
            continue
示例#7
0
    def get_input():
        
              
        command = input("\nWhat do you want to do? [hit] [examine] [run] [say]\n\nCommand >> ").split()
        verb_word = command[0]
        
        run = False

             
        if verb_word == "run": # Exit game and run away
            run = util.yesOrNo("\nYou want to " + verb_word + ".\nAre you sure? (Y/N) >> ")
            if run == True:
                print("\n\t\tYou run away!\n")
                return True
            else:
                return False
            
        elif verb_word in verb_dict:
            verb = verb_dict[verb_word]
        else:
            print("Unknown verb {}" .format(verb_word))
            return False
        
        if len(command) >= 2:
            noun_word = command[1]
            print (verb(noun_word))
        else:
            print(verb("nothing"))
            
        if dog1.health <= 0:
            run = True
            print("\n\t\t\tYou win the battle!")
            print("\t\tYou have gained 5 experience ponts")
            exp = 5
            player.lvl = get_object.Level(exp)
            print("\n\n" + "-"*90 + "\n")
            return run
        elif Tak.health <= 0:
            run = True
            print("You lost the battle!")
            return run
        
        return run
示例#8
0
def getWeapon():
    class weapon(object):
        weapon_name = ""
        objects = {}

        def __init__(self, name, att_die, cost):
            self.name = name
            self.att_die = att_die,
            self.cost = cost
            weapon.objects[self.name] = self

    fist = weapon("fist", 2, 0),
    kubaton = weapon("kubaton", 4, 5),
    knife = weapon("knife", 4, 5),
    stick = weapon("stick", 4, 0),
    rusty_sword = weapon("rusty-sword", 6, 10),
    short_sword = weapon("short-sword", 7, 50),
    sword = weapon("sword", 8, 100),
    tanto = weapon("tanto", 10, 300),
    katana = weapon("katana", 15, 500),
    staff = weapon("staff", 10, 150)

    tempWeap = ""

    while True:
        tempWeap = weapInput("\nChoose your weapon. >> ")

        if tempWeap in weapon_list:
            yes = util.yesOrNo(tempWeap +
                               ", is this the weapon you want? (Y/N) >> ")

            if yes:
                charWeap = weapon.objects[tempWeap]
                return charWeap.att_die
            else:
                pass
        else:
            continue
示例#9
0
def getWeapon():
    player.name = "..."
    player.exp = 0
    player.lvl = 1
    # Name,       exp,             lvl,     ac, strength, intel, weap1, att_die1, weap2, att_die2
    Tak = player.Character(player.name, player.exp, player.lvl, 10, 10, 10,
                           "none", 0, "none", 0)

    #  Quest Name,
    LtlBell = quest_log.Little_Bell("Little Bell")
    LtlBell.active = False

    pause = 1.5
    pause2 = 1.25
    exp = 0

    print("\t\t\t\tBOOK ONE - EARTH\n\n")  # Opening Chapter
    time.sleep(3)

    def print1():  # set parameters for printing opening paraghraph
        line = 0
        while line < 8:
            print(line_dict1[line])
            time.sleep(pause)
            line = line + 1

    line_dict1 = [
        "\n\tSlowly and painfully you open your eyse, you wake up in a daze...",  #0
        "\tYour head hurts... You taste copper in your mouth...",  #1
        "\tThere is a strong smell of blood in the air...",  #2
        "\tYou are having a hard time remembering who you are...",  #3
        "\tAnd where you are...\n",  #4
        '\n\t"W... What... What is my name?" you ask yourself...',  #5
        "\tA name slowly works its way into your mind...",  #6
        "\tWas it Takezo?... \n\n\n" + "-" * 90 + "\n",  #7
    ]

    #sets users name into util file for future use
    print1()
    Takezo = util.yesOrNo("Do you want to use the name Takezo? (Y/N) >> "
                          )  #uses yesOrNo in utilities file to get user input
    if Takezo:
        player.name = "Takezo"  #If "Yes" - Player name is "Takezo"
    else:
        player.name = get_name.getName(
        )  #If "No" - get_name.getName file will get user input and collect name
    print("\n\n" + "-" * 90 +
          "\n\n")  # prints 90 "-" on sereen for a line break

    def print2():  # set parameters for printing second paraghraph
        line = 0
        while line < 14:
            print(line_dict2[line])
            time.sleep(pause2)
            line = line + 1

    line_dict2 = [
        "\n\tYou have a horrible headake...",  #0
        "\tYour memory is still a little foggy...",  #1
        "\tYet you are able to remember that your name is... " +
        player.name,  #2
        "\n\t" + player.name + ", You manage to lift your head a little.",  #3
        "\tYou take a look around...",  #4
        "\tLow dark clouds float accross the ominous sky...",  #5
        "\tThere are dead horses and dead [bodies] everywhere...",  #6
        "\tThousands of them...",  #7
        "\tYou look down at your[self] and at the [ground]...",  #8
        "\tThere is blood everywhere...",  #9
        "\tHow long have I been here?...",  #10
        '\t"Was I in a battle? How am I still alive?" You ask yourself...\n',  #11
        "\tIs the battle still going on?...",  #12
        #"\t",
        "\t" + player.name +
        ", You realise that you may still be in danger and need a weapon...\n\n"
        + "-" * 90 + "\n"  #13
    ]

    print2()

    def get_input():

        player.att_die1 = 0
        player.weap1 = "none"

        command = input(
            "\nWhat do you want to do? [search] [examine] [say]\n\nCommand >> "
        ).split()
        verb_word = command[0]

        end = False

        if verb_word == "hit":
            verb = verb_word
            print("There is nothing here to hit")
            return False
        elif verb_word in verb_dict1:
            verb = verb_dict1[verb_word]
        else:
            print("Unknown verb {}".format(verb_word))
            return False

        if len(command) >= 2:
            noun_word = command[1]
            if noun_word == "bodies" and LtlBell.active == True:
                print("\n\t\tYou already searched the bodies.")
            else:
                print(verb(noun_word))
        else:
            print(verb("nothing"))

        if player.att_die1 > 0:  # Did the player equip a weapon?
            end = True
        else:
            end = False

        return end

    def say(noun):
        return '\nYou said "{}".\n'.format(noun) + "-" * 90 + "\n\n"

    def examine(noun):
        if noun == "ground":
            return """\n\n\tThe ground is covered in bodies, and blood...
\tThere are flies buzzing around everywhere
\tIt looks like there might be something else here...
\tIf you [search] closer....\n\n"""
        elif noun == "bodies":
            return """\n\n\tThe bodies smell foul and look even worse...\n\n"""
        elif noun == "self":
            return """\n\n\tYour head still hurts and you are covered in blood...\n\n"""
        elif noun == "sky":
            return "\n\n\tNow is not the time for cloud watching...\n\n"
        else:
            return "\n\nThere is no {} here.\n\n\n" + "-" * 90 + "\n".format(
                noun)

    def search(noun):

        if noun == "bodies":
            LtlBell.log = "Battlefield bodies did not have wapons... Currious."
            LtlBell.active = True
            exp = 1
            player.lvl = get_object.Level(exp)
            return """\n\n\tThat's strange... There are no weapons here...
\tThese warriors should have weapons!\n\tYou gain 1 experience point\n\n"""

        if noun == "sky":
            return "\n\n\tYou look to the gods for answers and find none...\n\n"

        elif noun == "ground":

            yes = util.yesOrNo(
                "\n\nYou find a stick on the ground,\nDo you want to use it as a weapon? (Y/N) >> "
            )
            if yes:
                weapon = get_object.gameWeapon("stick")
                if not weapon:
                    return "\n\n" + "-" * 90 + "\n\n"
                else:
                    player.att_die1 = weapon
                    player.weap1 = "stick"
                    exp = 6
                    player.lvl = get_object.Level(exp)
                    return "\n\nI guess this stick will have to do for now.\n\t\tYou gain 6 experience ponts\n\n" + "-" * 90 + "\n"

            else:
                yes = util.yesOrNo(
                    "\nDo you want to use your fists as a weapon? (Y/N) >> ")
                if yes:
                    weapon = get_object.gameWeapon("fist")
                    if not weapon:
                        return "\n\n" + "-" * 90 + "\n\n"
                    else:
                        player.att_die1 = weapon
                        player.weap1 = "fist"
                        exp = 5
                        player.lvl = get_object.level(exp)
                        return "\n\nI guess i'll have to use my fists for now.\n\t\tYou gain 5 experience points\n\n-" + "-" * 90 + "\n"

                else:
                    return "\n\n" + "-" * 90 + "\n\n"
        else:
            player.att_die = 0
            return '\n\nYou cannot search "{}" \n\n'.format(
                noun) + "-" * 90 + "\n"

    #Set verb dictionary
    verb_dict1 = {
        "say": say,
        "examine": examine,
        "search": search,
    }

    end = False
    while end == False:
        end = get_input()
    else:
        return False