Beispiel #1
0
while running:
    print("============================")
    print("\n")
    print("NAME      HP                 MP")
    for player in players:
        player.getStats()
    print("\n")
    for enemy in enemies:
        enemy.getEnemyStats()
    for player in players:
        player.chooseAction()
        index = int(input("Choose action:")) - 1

        #Chose Attack
        if index == 0:
            dmg = player.generateDamage()
            enemy = player.chooseTarget(enemies)
            enemies[enemy].takeDamage(dmg)
            print("You attacked " + enemies[enemy].name.replace(" ", "") + " for", dmg, "points of damage. Enemy HP:",
                  enemies[enemy].getHp())
            if enemies[enemy].getHp() == 0:
                print(enemies[enemy].name.replace(" ", "") + " has been defeated.")
                del enemies[enemy]

        #Chose Magic
        elif index == 1:
            player.chooseMagic()
            magicChoice = int(input("Choose magic:")) - 1
            if magicChoice == -1:
                continue
            spell = player.magic[magicChoice]
Beispiel #2
0
enemy = Person(1200, 76, 67, 88, [])

running = True
i = 0

print(bcolors.FAIL + bcolors.BOLD + "Enemy Attack!" + bcolors.ENDC)

while running:
    print("====================")
    player.choose_Action()
    choice = input("Choose an action: ")
    index = int(choice) - 1
    print("You chose ", index)

    if index == 0:
        player_damage = player.generateDamage()
        enemy.takeDamage(player_damage)
        print("You attacked for", player_damage,
              "points of damage. Enemy HP: ", enemy.getHp())

    elif index == 1:
        player.choose_Magic()
        magic_choice = int(input("Choose magic:")) - 1
        magic_damage = player.generateSpellDamage(magic_choice)
        spell = player.getSpellName(magic_choice)
        cost = player.getSpellMpCost(magic_choice)

        current_mp = player.getMp()

        if cost > current_mp:
            print(bcolors.FAIL + "You are unable to use magic at this time " +