enemies[enemy].take_damage(dmg) print( "You attacked " + enemies[enemy].name.replace(" ", "") + " for", dmg, "Points of damage") if enemies[enemy].get_hp() == 0: print(enemies[enemy].name.replace(" ", "") + " has died.") del enemies[enemy] elif index == 1: player.choose_magic() magic_choice = int(input(" choose magic")) - 1 if magic_choice == -1: continue spell = player.magic[magic_choice] magic_dmg = spell.generate_damage() current_mp = player.get_mp() if spell.cost > current_mp: print(bcolors.FAIL + "\n not enough mp\n" + bcolors.ENDC) continue player.reduce_mp(spell.cost) if spell.type == "white": player.heal(magic_dmg) print(bcolors.OKBLUE + "\n" + spell.name + " heals for", str(magic_dmg), "HP" + bcolors.ENDC) elif spell.type == "black": enemy = player.choose_target(enemies) enemies[enemy].take_damage(magic_dmg) print(
while running: print("=======================") player1.choose_action() choice = int(input("Choose Action: ")) - 1 if choice == 0: damage = player1.generate_damage() enemy1.hp -= damage print("\nYou attacked for {} points of damage.".format(damage)) elif choice == 1: player1.choose_spell() magic_choice = int(input("Choose Spell: ")) - 1 spell = player1.magic[magic_choice] cost = spell.cost print("\nYou chose " + fonts.FAIL + spell.name + fonts.ENDC) hp_mod = spell.generate_damage(spell) if cost > player1.get_mp(): print(fonts.WARNING, "\nYou do not have enough MP!!", fonts.ENDC) continue player1.mp -= cost if spell.type == "black": enemy1.hp -= hp_mod print("\nYour {} spell did {} points of damage.".format( spell.name, hp_mod)) elif spell.type == "white": player1.heal_hp(spell.damage) enemy1_choice = 1