Designing an enemy skill that targets only low HP actors

Hello, so I've been working on a boss encounter in my test game and I want to give him a "finishing move" so to speak.


This is the concept I have in mind:


1. Boss is able to use this "finishing move" (let's say it deals 500 damage) as long as one or more actors have less than or equal to 25% of max HP


2. The Boss can only target actors with the above mentioned low HP (For example, if actors A and B have low HP but actors C and D do not meet the requirements, the boss can only target actors A and B with the skill)


3. If none of the actors' HP is low enough, for instance if one of them gets healed, then the boss will no longer be able to use that skill until one or more actors' HP falls below that threshold again


How would I begin constructing something like this? Thanks!
You will need Yanfly battle AI core : http://yanfly.moe/2015/10/19/yep-16-battle-a-i-core/
Aye, thank you good sir. I shall check that out!

Original thread: https://forums.rpgmakerweb.com/threads/designing-an-enemy-skill-that-targets-only-low-hp-actors.61193/