Adaptable State

I kindda have this idea for a state like this

When applied, the status checks the enemy ID to apply Another State depending on the ID

Example: If Enemy1 gets the state, they get another state that reduces their defense, but if Enemy 4 gets it, they get a state that Increases their ATK by 200%

I'm planning on using it with Olivia's Shield Break System as it does not allow to make enemies to use a different Break state of their own, so making a state that adds the state to the enemy could be nice

Maybe like this practice

If enemy ID = 1,2,3,4
Add State Defense Down

If Enemy ID = 5,6,7,8
Add State Enragement

If none
Add Stun

The problem is that I dont know how I could apply it, I know I could using Yanfly States Core

But I dont know how to use the right JS

I tried, but failed, so, can someone help me?
Was user the one the state was applied on in MV Yanfly stuff? Then:

<Custom Apply Effect>
if (user.isEnemy() && [1,2,3,4].some(id => user.enemyId() === id)) {
user.addState(X);
} else if (user.isEnemy() && [5,6,7,8].some(id => user.enemyId() === id)) {
user.addState(Y);
} else {
user.addState(Z);
}
user.removeState(plugin state id);
</Custom Apply Effect>

EDIT: Or maybe don't remove the original state if it interacts with Olivia Break Shields
If you're going to write a script, using Yanfly you can actually create a State that affects different enemies in different ways.
OH MY GOD IT WORKED, THANK YOUUUUUUU
Was user the one the state was applied on in MV Yanfly stuff? Then:

<Custom Apply Effect>
if (user.isEnemy() && [1,2,3,4].some(id => user.enemyId() === id)) {
user.addState(X);
} else if (user.isEnemy() && [5,6,7,8].some(id => user.enemyId() === id)) {
user.addState(Y);
} else {
user.addState(Z);
}
user.removeState(plugin state id);
</Custom Apply Effect>

EDIT: Or maybe don't remove the original state if it interacts with Olivia Break Shields

And yeah, if you want to keep the state, you have to remove the state removal

THANK YOUUUUUU!!!

this also can work as a kind of "Chaotic state" like, inflicting a debuff depending on what enemy is used on easily if you use the state removal
You can also have a JSON that holds all the data for different states and use the ID marker as a reference to the state you want. I have something similar in my game for which enemy spawns in what map.

Original thread: https://forums.rpgmakerweb.com/threads/adaptable-state.179422/