MV Using code to check the state of a skill's target

Alright, this should be simple. I'm using a plugin to make a skill that checks if the target has a certain state before actually taking effect. the code is as follows:
Code:
if (user.isStateAffected(4)) {
The obvious issue is that it's checking the user's state as opposed to the target's, but I don't know what to replace user with.
Thanks in advance.
target
But I tried that...
Alright, give a minute, I'm clearly missing something.
In that case you should read this carefully and provide sufficient information:
Using Yanfly's Skill Core I added the following to a skill's note box:
Code:
<Custom Execution>
if (target.isStateAffected(4)) {
  target.addState(5);
}
</Custom Execution>
Shouldn't this work?
<custom execution> doesnt have a variable for the skill's targets. if you want to add that state before damage happens youll want to look at <before eval> or <pre-damage eval>
<custom execution> doesnt have a variable for the skill's targets
How do you find that out? I don't see anything on the plugin page.
youll want to look at <before eval> or <pre-damage eval>
Yup, that worked. You're too good to me, Robro.
How do you find that out? I don't see anything on the plugin page.
it wouldnt be there, unfortunately. Yanfly's documentation for their plugins sometimes leaves out details that youll either have to piece together through trial and error or by reading the code yourself. <custom execution> mechanically works very differently from the skill phase notetags in a few ways.

Original thread: https://forums.rpgmakerweb.com/threads/using-code-to-check-the-state-of-a-skills-target.180538/