MV Learned Skill Usable Only Under Any Negative State

As title says.

I wanted a skill that would only be usable while under "negative" states via YEP's Skill Core. A forum search shows how to make one while under a specific state, but I need a skill where it becomes usable while under any of the states listed as "negative" ones. Below is where I hit a dead end:

Code:
<Custom Requirement>
var debuffCheck = [];
debuffCheck.push(22, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35);
for (var j = 0; j < debuffCheck.length; ++j) {
var id = debuffCheck[j]
if (!user.isStateAffected(id)) {
value = false;
}
}
</Custom Requirement>

TIA
JavaScript:
// You can change the line where "isStateAffected" is mentioned to this:
if (user.isStateAffected(id)) {
    value = true;
} else {
    value = false;
}

For a more efficient way of doing this, in case you need it for some other skill is Yanfly's State Categories which has a line for these types of scenarios:
JavaScript:
// battler.isStateCategoryAffected('YOUR CATEGORY NAME HERE');
// EXAMPLE:
value = user.isStateCategoryAffected('debuffs');
<Custom Requirement> var debuffCheck = []; debuffCheck.push(22, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35); for (var j = 0; j < debuffCheck.length; ++j) { var id = debuffCheck[j] if (!user.isStateAffected(id)) { value = false; } } </Custom Requirement>
the problem with that is that is that in that case, even if you had the first debuff in that list, if you didnt have the last one, value is set to false. i forget if value being undefined lets it pass as true or if it starts as true by default within the tag, but if you dont have *every* one of those debuffs, value wont be anything other than false.
TobyYasha's suggestion works, but to make what you did work you could have started with value false, and then while looping through that array, only make value true if any one of states were active.

But thats also what the array.some() method is for.
Code:
<Custom Requirement>
var debuffCheck = [22, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35];
value = debuffCheck.some(debuff => user.isStateAffected(debuff));
</Custom Requirement>
With a slight caveat you can do this even without plugins.

you need to give the skills this should apply to an extra skill type different from the normal skill types - name it counter or debuff or whatever.

You do NOT give that skill type to the actor directly, but have all negative states add that skill type to their target.

Then when the actor learns the skill he can't use it due to missing skill type until the negative states add the skill type.
and this will be obvious by the new skill type becoming available in battle only when under those negative states.
For a more efficient way of doing this, in case you need it for some other skill is Yanfly's State Categories which has a line for these types of scenarios:
JavaScript:
// battler.isStateCategoryAffected('YOUR CATEGORY NAME HERE');
// EXAMPLE:
value = user.isStateCategoryAffected('debuffs');
I... forgot this plugin exists. This had easily solved my problem. orz
the problem with that is that is that in that case, even if you had the first debuff in that list, if you didnt have the last one, value is set to false. i forget if value being undefined lets it pass as true or if it starts as true by default within the tag, but if you dont have *every* one of those debuffs, value wont be anything other than false.
TobyYasha's suggestion works, but to make what you did work you could have started with value false, and then while looping through that array, only make value true if any one of states were active.

But thats also what the array.some() method is for.
Code:
<Custom Requirement>
var debuffCheck = [22, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35];
value = debuffCheck.some(debuff => user.isStateAffected(debuff));
</Custom Requirement>
Works as intended, thanks!
With a slight caveat you can do this even without plugins.

you need to give the skills this should apply to an extra skill type different from the normal skill types - name it counter or debuff or whatever.

You do NOT give that skill type to the actor directly, but have all negative states add that skill type to their target.

Then when the actor learns the skill he can't use it due to missing skill type until the negative states add the skill type.
and this will be obvious by the new skill type becoming available in battle only when under those negative states.
I like this implementation, if not busy work from how I'm doing things atm. Hopefully someone else finds use for this.

Original thread: https://forums.rpgmakerweb.com/threads/learned-skill-usable-only-under-any-negative-state.165352/