Need help with a script to set enemy default ability when restriction is set to "attack anyone/ally/enemy"

Essentially, I'm looking to see if it's possible to have a script that lets me put a notetag with a skill I would want to replace "attack" when under the effect of "attack anyone" (confusion,) "attack an ally" (charm,) or "attack an enemy" (berserk.) I would want it to behave like normal if that ability type is sealed; ie it can't be used, and the enemy takes no other action due to not having other actions it can take.

Whatever is easiest, I can do one skill have the script set it to anyone/ally/enemy
Ex:
<Notetag 23>
Or define the for enemy, for ally skills
Ex:
<Notetag_Enemy_Target 23>
<Notetag_Ally_Target 24>
Or something like this (I have enough room to duplicate skills, is what I mean.)

I'm not using any other scripts that I believe would modify combat, at least not in a way that would mess with this as far as I know.
This would be for a project that could possibly be commercial.

Kind of afraid it can't be done since I feel like I would have been able to find one that does this, but that's why I'm asking.

Okay, the background:

My game uses varying attack language for enemies ("X bites down hard!"; "X kicks at your shins!") and I wanted to preserve this. I found a couple of possible solutions but I don't like either of them.

One is a script that flips the ally/enemy and allows any skill to be used from the enemy's list - but I think this would mess with some of the ones I have set up by triggers.

Another suggestion was to have the state actually not cause the effect, but instead just use a high priority and the state as the prereqs to use the skill; although this could be messy for enemies with a lot of priorities based on different things that get too close to 10 already - or, if the skill is blocked by a state or something else (no mp for an mp skill, for example,) it could default to using a different one.

Original thread: https://forums.rpgmakerweb.com/threads/need-help-with-a-script-to-set-enemy-default-ability-when-restriction-is-set-to-attack-anyone-ally-enemy.173918/