AI Perception seems intermittent

The above screenshot is a section that is called when I use my weapon to attack, which 90% of the time reduces the enemies health by 25 (of 100). It kills 90% of the monsters, but I end up with one or two invulnerable AIs (not taking damage, but just hitting me back) because AI Perception from my Player Character is not detecting them.

If anyone has had this experience let me know what I should do – perhaps AI Perception needs tweaking?