I decided to have some fun with Python Code, and for some reason, it glitches out of all the for loops and skips all the other hero’s moves. It is supposed to run through all the heroes first, then run the enemies’ AI code. However, it keeps on looping through the same hero over and over again, while after the same hero moves, the entire team of enemies moved.
I have not looked at your code fully, but please do not use a global variable and changing in a procedure without the GLOBAL keyword,
I keep seeing people here using all these global variables and ignoring issue of scoping while it is always safer to never use global variables and if needed pass the as argument or return things to add to a global variable.
This is global, the best would be to have the hero init return self and add it to heroes_list in his scope and not the class.
Classes should be self contained except for constants.
I am not sure this is your problem, but it is also a possible problem,
For your problem try to add some prints in the battle loop to understand what conditions is triggering a loop break or return that should not happen.
I run it through with a debugger, and the hero class is designed to catch errors though. However, it somehow glitches right out of the hero for loop and straight to the AI loop without any errors, and since the enemies are also an object of the Hero class, that probably isn’t the case. . . thanks for pointing this out, though.
Skip the debugger and add prints in the battle loop of the type print(1), print(2) and so forth (with " of course) to monitor where the battle loop does not do what it is supposed to do.
Then print the variables and see what is causing it.