Ok I think I understand the problem you're describing but the point of the for each is to run through each instance to check which ones match the conditions and you can pick them, saying they must be 0 and 1 doesn't make a ton of sense. What are you trying to achieve with the loop or what data are you unable to gather?
So what im trying to do is have the enemy monsters target the player monsters to inflict a status affect.
Enemies target whoever has the least amount of health and is alive. Sometimes these status affects activate at the same time the enemy monster attacks. If the attack so happens to kill the player monster at the same time, the status affect that was meant meant for the inital target moves to the next player with the least health.
what im trying to do is even though the initial target dies, the status affect should NOT jump next in line and should instead disappear with the player monster that just died.