How do I make enemies only use heal/buff skills on enemies that aren't max HP/don't have a buff applied on them?

As the title says I'm having trouble with enemies healing enemies that are already at max HP, or enemies buffing enemies that already have a buff applied. I know there's a Visustella plugin for better enemy AI but I kinda don't wanna spend any money on plugins.
Maybe the following plugin can help? It's free.
Welcome!

Just to verify, are we talking about the right software? You posted in MZ support and you're referencing VisuStella, but your profile says you use VX Ace.

You can try what @Sword_of_Dusk linked you to, but I'm a little leery as its description says it doesn't add any additional functionality beyond the action rating and tgr preferences.

VisuStella's Battle Core, which is free, has some targeting-related notetags you could try. For example,
Code:
<JS Targets>
targets = user.friendsUnit().aliveMembers().filter(member => member.hp < member.mhp);
</JS Targets>

should only allow your heal skill to target allies that have taken damage.
but I'm a little leery as its description says it doesn't add any additional functionality beyond the action rating and tgr preferences.
I read that too, but it was the most immediate result I found. I'd keep looking, but I'm not the only one capable of Googling this.

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-enemies-only-use-heal-buff-skills-on-enemies-that-arent-max-hp-dont-have-a-buff-applied-on-them.164996/