Ejemplo n.º 1
0
i = 0

print(Bcolors.FAIL + Bcolors.BOLD + "AN ENEMY ATTACKS!" + Bcolors.ENDC)

while running:
    print("===========================")
    player.choose_action()
    choice = input("Choose Actions: ")
    index = int(choice) - 1

    if index == 0:
        dmg = player.generate_damage()
        enemy.take_damage(dmg)
        print("You attack for ", dmg)
    elif index == 1:
        player.choose_magic()
        magic_choice = int(input("Choose magic: ")) - 1

        spell = player.magic[magic_choice]
        magic_dmg = spell.generate_damage()

        current_mp = player.get_mp()

        if spell.cost > current_mp:
            print(Bcolors.FAIL + "\nNot Enough MP\n" + Bcolors.ENDC)
            continue
        player.reduce_mp(spell.cost)
        enemy.take_damage(magic_dmg)
        print(Bcolors.OKBLUE + "\n" + spell.name + " deals", str(magic_dmg), "points of damage" + Bcolors.ENDC)

    enemy_choice = 1
Ejemplo n.º 2
0
    # 2.a Main player starts first
    print("=======================================")
    print(f"\t {main_player.name.upper()}")
    main_player.choose_action()
    choice_input = input("\t\t\tChoose a number: ")
    index = int(choice_input) - 1
    print(f"\t You chose {main_player.action[index]}")

    # 2.b Physical attack
    if index == 0:
        dmg = main_player.generate_atk_damage()
        enemy.take_damage(dmg)
        print("=======================================")
        print(f"\t You attacked and dealt to {enemy.name} {dmg} points of damage")
    elif index ==  1:
        main_player.choose_magic()
        magic_choice = int(input("Choose your magic: "))
        magic_index = magic_choice - 1

        magic = main_player.magic[magic_index]

        # Generate magical damage
        magic_damage = magic.generate_damage()
        magic_name = magic.name
        magic_cost = magic.mp_cost

        # Check if player has enough MP to use
        if magic_cost > main_player.mp:
            print("Not enough MP")
            continue
        else:
Ejemplo n.º 3
0
            print(" ")

            print(bcolors.fail + bcolors.bold + "==============" + bcolors.endc)
            print(bcolors.fail + bcolors.bold + "= ENEMY DIED =" + bcolors.endc)
            print(bcolors.fail + bcolors.bold + "==============" + bcolors.endc)
            break

        if hero.hp == 0:
            print(" ")
            print(bcolors.fail + bcolors.bold + "=============" + bcolors.endc)
            print(bcolors.fail + bcolors.bold + "= HERO DIED =" + bcolors.endc)
            print(bcolors.fail + bcolors.bold + "=============" + bcolors.endc)
            break

    elif int(choose) == 2:
        hero.choose_magic()
        chose_mgc = int(input("Choose magic: ")) - 1

        spell = hero.magic[chose_mgc]
        magic_dmg = spell.generate_spell_dmg()

        current = hero.get_mp()
        hero.reduce_mp(spell.cost)

        if spell.cost > current:
            hero.mp = current
            print(bcolors.fail + "\n you dont have enough MP" + bcolors.endc)
            continue

        if spell.type == "black":
            enemy.get_dmg(magic_dmg)
Ejemplo n.º 4
0
print(bcolors.FAIL + bcolors.BOLD + "An enemy attacks!" + bcolors.ENDC)

while running:
    print("*********")
    pla.choose_action()
    choice = input("Choose action!")
    index = int(choice)-1

    #print("You chose",pla.get_spell_name(int(index)))
    if index ==0:
        dmg=pla.generate_damage()
        enemy.take_damage(dmg)
        print("You attacked",dmg,"Points of damage",enemy.get_hp(),"is enemy's health")
    elif index ==1:
        pla.choose_magic()
        magic_choice=int(input("Choose magic"))-1
        if magic_choice == -1:
            continue
        spell = pla.magic[magic_choice]
        dmg=spell.generate_damage()



        current_mp=pla.get_mp()

        if spell.cost > current_mp:
            print(bcolors.FAIL + "\nNot enough MP\n" + bcolors.ENDC)
            continue

        pla.reduce_mp(spell.cost)
Ejemplo n.º 5
0
win_color = bcolors.OKGREEN + bcolors.BOLD + "You win!" + bcolors.ENDC

print(bcolors.FAIL + bcolors.BOLD + "AN ENEMY ATTACKS!" + bcolors.ENDC)

while run:
    print('============================')
    player1.choose_action()
    choice = input("Choose action: ")
    index = int(choice) - 1

    if index == 0:
        dmg = player1.generate_damage()
        enemy1.take_damage(dmg)
        print("You attacked for", dmg, "points of damage")
    elif index == 1:
        player1.choose_magic()
        magic_choice = int(input("Choose magic: ")) - 1

        if magic_choice == -1:
            continue

        spell = player1.magic[magic_choice]
        magic_dmg = spell.generate_damage()

        current_mp = player1.get_mp()

        if spell.cost > current_mp:
            print(bcolors.FAIL + "\nNot Enough MP\n" + bcolors.ENDC)
            continue

        player1.reduce_mp(spell.cost)