

Print (, ) #here its returning the original hp While alive(pokemon1) and alive(pokemon2): Print (trainer1.name, 'chose', pokemon1.name, '\n', trainer2.name, 'chose', pokemon2.name) Pokemon2 = random.choice(trainer2.pokemon) Print ('Choose a pokemon:', trainer1.pokemonname) Me = Trainer('You', weavile) #or choose ambipom to winĭef alive(pokemon): #check if the pokemon is aliveĭef battle(trainer1, trainer2): #battle between two trainers Weavile = Pokemon ('Weavile', 150) #change the hp to more than 150 if you want to win Oponent.hp = oponent.hp - 150 #just for a test Anyone knows why is it happening? I want it to continue with the current hp of both pokemon at the end of the loops and battle. It makes non sense for me because the code is identical for both trainers. I tried a lot to found the error and I discovered that when it exits the 'while alive(pokemon1) and alive(pokemon2)' loop, the pokemon1 hp returns to full hp but the pokemon2 remains with the current hp (I've put a print to show it).

I thought it was working fine, but then I found that if I lose the battle the program enters in an infinite loop. I've created the pokemon and trainer classes and I want to implement the battle mechanics. I'm new on python and I'm trying to do a Pokemon game (like the gameboy and nds games).
