MV Drain states skill

Hi all,
I’m trying to create a skill for an enemy that drains/removes certain negative states from the player's party.
For each state he drains/removes, he gets healed by 100 HP.

For example:
The player's party with 3 battlers has 6 states in total (2 states per battler) that he could drain. The enemy uses that skill, removes all 6 states, and is healed by 600 (6 * 100) HP.

I want to be able to control which states he can remove with that skill. For example, in that particular battle, the player's party could have states 5, 6, 7, 8, 9, and 10. That would be 6 states in total per battler (18 states total), meaning the enemy would drain them and heal for 1800 (18 * 100) HP. I don’t want him to drain positive states like "DEF Up" (e.g., state 20).

I can cure all states that I need in the skill, but I don´t know how to heal the enemy.
Thanks in advance
It sounds like this might be doable almost purely in the damage formula. Set Type to HP Drain and Variance to 0, and disable Criticals. Then add a remove state effect for each state.

JavaScript:
100 * [5,6,7,8,9,10].reduce((total,next) => b.isStateAffected(next) ? total + 1 : total, 0)

Note: Doing it this way would mean that the 1800 HP in your example would be divided into 3 separate heals of 600 HP, one per party member. Also, if the states depend on the battle and not the enemy, it won't work exactly as I wrote above, though it could still be modified to work in that case. Also, this approach damages the party as well; I'm not sure if that can be avoided. (I can imagine applying a "negate damage" state to the player beforehand and removing it after, but I think negating the damage would also negate the drain, so that probably doesn't work.)

Also: If you use Yanfly/VisuStella, there's probably something in there that would make this work, but since I don't use it, I can't point you to the exact thing. The damage formula code I posted could probably be used there with only slight modifications.
@Solar_Flare
Thanks for the tip. I tested it and it works as you described. The only problem is that the skill also deals damage.

I'm trying to find a way to work around that or incorporate it.

Original thread: https://forums.rpgmakerweb.com/threads/drain-states-skill.182375/