Dark Knight Skill with the conditional aspect of Yanfly's Instant Cast Plugin causes battle test to crash

Hey, everyone. I'm making some skills for a Dark Knight, and I have one where the idea is that if the target has the fear state, it will become an instant skill, allowing the user to act again.
This is what I have in the note section of the skill. I will preface this by saying that I don't know Javascript like, at all:
<HP Cost: 15%>
<Instant Eval>
if (target.isStateAffected(30)) instant = true;
</Instant Eval>
if (target.isStateAffected(30)){
var gain = .15*user.mhp;
user.hp += gain;
target.removeState(30);
}

I basically copied and pasted the example from the help section in Yanfly's Instant Cast Plugin, but changed it from if the user's attack is equal to or more than 300 to what I have here. That section is the only section that messes up, as I've isolated each part of the note and tried again.

Any time I try to battle test, the test crashes, with the error code: require(...).Window.get(...).isDevToolsOpen is not a function.

Now, is this something with the Script, or is it something on my end, i.e. the code?

I don't really know Javascript all that well, but I do know Java. I've just taken to trying things out, and most of the time, they work. But if this is something with me, then what is it, and how do I fix it?
I have seen in multiple yanfly plugins the following update:
* - Bypass the isDevToolsOpen() error when bad code is inserted into a script call or custom Lunatic Mode code segment due to updating to MV 1.6.1..
Sounds like you're using an older version of at least one of the plugins. Probably the instant cast plugin, since that's the one that'd be reading the note tag.

Your note tag also appears to contain a block of code which is not contained inside any tags, so it will never be parsed. I think you want that second if check wrapped inside of an <After Eval> tag. I'm not sure that's what's causing the problem here, though.

Without being able to see the error that should be thrown by this note tag, I'd suspect the <Instant Eval> tag does not have access to the target of the skill, so as target is not defined, it can't check if the target has a state on it or not.

After updating the instant cast plugin, try replacing 'target' with 'BattleManager._targets[0]' in your note tag. I'm not sure it will work either, but give that a try and see what happens.
Additionally please keep in mind that the battletest uses some shortcuts to speed up its launch, and those shortcuts do not work with every plugin.

If you get an error in battletest, then you should always check that same battle in a regular playtest. ONLY if that playtest get you the same error you should go to solve it. Because only then you are guaranteed that this is a true error and not caused by the battletest skipping initialization functions.
After updating the instant cast plugin, try replacing 'target' with 'BattleManager._targets[0]' in your note tag. I'm not sure it will work either, but give that a try and see what happens.

This is exactly what it needed, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/dark-knight-skill-with-the-conditional-aspect-of-yanflys-instant-cast-plugin-causes-battle-test-to-crash.119901/