player.heal(item.prop) print(bcolors.OKGREEN + "\n" + item.name + " heals for", str(item.prop), "HP" + bcolors.ENDC) elif item.type == "greatpotion": player.heal(item.prop) print(bcolors.OKGREEN + "\n" + item.name + " heals for", str(item.prop), "HP" + bcolors.ENDC) elif item.type == "bomb": enemy.take_damage(item.prop) print(bcolors.FAIL + "\n" + item.name + " takes damage", str(item.prop), "HP" + bcolors.ENDC) enemy_choice = 1 enemy_dmg = enemy.generate_damage() player.take_damage(enemy_dmg) print("Enemy attacks for ", enemy_dmg, "Player HP ", player.get_hp()) print("-------------------") print("ENEMY HP:", bcolors.FAIL + str(enemy.get_hp()) + "/" + str(enemy.get_max_hp()) + bcolors.ENDC) print("YOUR HP", bcolors.OKGREEN + str(player.get_hp()) + "/" + str(player.get_max_hp()) + bcolors.ENDC) print("YOUR MP", bcolors.OKBLUE + str(player.get_mp()) + "/" + str(player.get_max_mp()) + bcolors.ENDC) if enemy.get_hp() == 0: print(bcolors.OKGREEN + "YOU WIN" + bcolors.ENDC) running = False elif player.get_hp() == 0: print(bcolors.FAIL + "YOU LOSE!" + bcolors.ENDC) running = False
Enemy_hp_per_bar=int((Enemy_hp_per/100)*26) for i in range(Enemy_hp_per_bar): E_HP+="█" for i in range(26-Enemy_hp_per_bar): E_HP+=" " P_HP="" Player_hp_per=(player.get_hp()/player.get_max_hp())*100 Player_hp_per_bar=int((Player_hp_per/100)*26) for i in range(Player_hp_per_bar): P_HP+="█" for i in range(26-Player_hp_per_bar): P_HP+=" " P_MP="" Player_mp_per=(player.get_mp()/player.get_max_mp())*100 Player_mp_per_bar=int((Player_mp_per/100)*26) for i in range(Player_mp_per_bar): P_MP+="█" for i in range(26-Player_mp_per_bar): P_MP+=" " #print(E_HP,Enemy_hp_per_bar) #print(P_HP,Player_hp_per_bar) print("**************************************") print("Player") print() print("Enemy HP:", str(enemy.get_hp())+ "/"+ str(enemy.get_max_hp())," |{}|".format(E_HP))
player.choose_item() item_choice = int(input("choose item:")) - 1 if item_choice == -1: continue item = player.items[item_choice] if item.type == "potion": player.heal(item.prop) print( Bcolors.OKGREEN + "\n" + item.name + "you have been healed for:", str(item.prop), "hp" + Bcolors.ENDC) enemy_choice = 1 enemy_dmg = enemy.generate_damage() player.take_damage(enemy_dmg) print("enemy attacks for", enemy_dmg) print("-----------------") print( "enemy hp:", Bcolors.FAIL + str(enemy.get_hp()) + "/" + str(enemy.get_max_hp()) + Bcolors.ENDC + "\n") print("your hp:" + Bcolors.OKGREEN + str(player.get_hp()) + "/" + str(player.get_max_hp()) + "/" + Bcolors.ENDC) print("your mp:" + Bcolors.OKBLUE + str(player.get_mp()) + "/" + str(player.get_max_mp()) + "/" + Bcolors.ENDC + "\n") if enemy.get_hp() == 0: print(Bcolors.OKGREEN + "you win!" + Bcolors.ENDC) running = False elif player.get_hp() == 0: print(Bcolors.FAIL + "your enemy has defeated you!" + Bcolors.ENDC) running = False
if item.type == "potion": player.heal(item.prop) print(bcolors.OKGREEN + "\n" + item.name + " heals for", str(item.prop), "HP" + bcolors.END) enemy_choice = 1 enemy_dmg = enemy.generate_damage() player.take_damage(enemy_dmg) print("Enemy attacks for", enemy_dmg) print("----------------------------") print( "Enemy HP:", bcolors.FAIL + str(enemy.get_hp()) + "/" + str(enemy.get_max_hp()) + bcolors.END + "\n") print( "Your HP:", bcolors.OKBLUE + str(player.get_hp()) + "/" + str(player.get_max_hp()) + bcolors.END + "\n") print( "Your MP:", bcolors.OKBLUE + str(player.get_mp()) + "/" + str(player.get_max_mp()) + bcolors.END) if enemy.get_hp() == 0: print(bcolors.OKGREEN + "You win!!" + bcolors.END) elif player.get_hp() == 0: print(bcolors.FAIL + "Your enemy has defeated you!" + bcolors.END) running = False