I don't know if I get exactly what you ask, but I've recently created a very modular system for something similar and I'm very proud of it.
In my roguelike dungeon crawler, I've put every entity (as in the player, enemies, and even stuff like breakable pots and crates but that is irrelevant here) into an Entities family. Then, one of the variables for that is Target, which contains the UId of another entity this entity desires to attack. Then all the logic that controls the entities always uses the target variable to define what they are attacking, walking towards, or anything really. So all the enemies' Target is defaulted to the player's UId, but I can make any of them fight any of them if I really want to. AND THAT IS AWESOME!
edit: oh and I forgot a very important bit: every weapon an entity can use shoots a projectile (even if it's melee, it's just a shorter ranged one), and that has a variable that contains the UId of entity who fired it. That way, damage is "signed", and can therefore only damage other entities. That logic also applies to "teams". All enmies, for example, also sign their damage as the "enemies" team, and then each weapon may define if it's bullet has friendly fire or not. If it has not, that will only damage entities on other teams. So enemies can even target and destroy crates on the layout if I include so in their AI.
Man I love this system, hope it helps.