yosualb
Player.UID is the UID of the selected player. For ensuring every player selected/every enemy selected has events 3 - 6 applied to them, you can just add a sub-event in each, cycling through the selected player/enemy. Using player.IID instead wouldn't help at all. on the contrary, the function "changeState" couldn't find the correct character.
If I'm not mistaking though, using a foreach should be useless. In the current state, the function should be called one time per player meeting the condition. (I could be mistaking though, better way to know is to use a debugger, here is mine)
But to debug and test as precisely as you want, you should put up some textDisplay per enemy/player, it's hard to know for now the real state of every characters. Using a container seems to be the way to do it, as there will never be a character with no life. And later you could replace it with a life bar if you prefer.
I moved the variables you used on player/enemy on their common family, character too, try to do this when things have the same comportment in game (bullet, life, attack speed, ...)
Plus, I would add a random Y (not a lot, just a little) so all characters are not above each others, and still trigger the collision detection.
Btw, if you want to push your program further, you should try to get rid of this every tick with 4 collision detection... it's costly, and in your case, you could just compare the maximum X of player and minimum X of enemy, to know where the fight is happening. It would be a lot easier on the CPU.