Пример #1
0
def start():
    global player1

    name = 0
    pClass = 3

    while name == 0 or len(str(name)) > 8:
        print("Enter your name")
        name = input(": ")
        if len(str(name)) > 8:
            print("Error: Name to long max 8 characters")

    while pClass == 3:
        print("Choose your class")
        print("1 > Warrior")
        print("2 > Archer")
        print("3 > Mage")

        pClass = input(": ").lower()

        if pClass == "1" or pClass == "warrior":
            pClass = 0
            php = 100
            pmp = 50
            pstr = 20
            pagl = 10

            player1 = Player(name, pClass, php, pmp, pstr, pagl)
            player1.giveItem(item150)

        elif pClass == "2" or pClass == "archer":
            pClass = 1
            php = 80
            pmp = 50
            pstr = 10
            pagl = 20

            player1 = Player(name, pClass, php, pmp, pstr, pagl)
            player1.giveItem(item151)

        elif pClass == "3" or pClass == "mage":
            pClass = 2
            php = 80
            pmp = 100
            pstr = 5
            pagl = 10

            player1 = Player(name, pClass, php, pmp, pstr, pagl)
            player1.giveItem(item152)

        else:
            print("Error: Wrong class")

    clear()
    print("Character created!")
    player1.giveItem(item1)
    player1.saveSlot = slot
Пример #2
0
            lol[0][1] = 2

        player1 = Player(lol[0][0], lol[0][1], int(lol[0][3]), int(lol[0][4]),
                         int(lol[0][5]), int(lol[0][6]))
        player1.hp = int(lol[0][2])
        player1.lvl = int(lol[0][7])
        player1.xp = int(lol[0][8])
        player1.lvlXp = int(lol[0][9])
        player1.money = int(lol[0][10])
        player1.battles = int(lol[0][11])
        player1.saveSlot = int(lol[0][12])
        player1.time = int(lol[0][13])
        player1.expLocation = lol[0][14]

        for i in range(len(lol[1])):
            player1.giveItem(globals()[lol[1][i]])

        for j in range(len(lol[2])):
            player1.on.append(globals()[lol[2][j]])

        for k in range(len(lol[3])):
            player1.recipes.append(globals()[lol[3][k]])

        game()

elif inp == "3" or inp == "quit":  #closes the game
    exit()

else:
    print("Error: Wrong input")