Negating Critical Hits

Is it possible to render all critical hits returning 0 damage by the use of a script given to an state? Would that require any plugins such as Yanfly's Damage Core and Critical Control to manage this here?

I'm also using Yanfly's AutoPassive States and if this is possible, I can put this script in the State database.

The purpose of this idea is that no matter how much attack power / magic the user has when initiating a critical, the resulting critical damage will always come out with 0 as long as the target has the state to negate critical hits.

See, what I mean here is when it's regular damage, there's going to be damage inflicted but if it's critical damage, it'd be 0 critical damage as long as the user has that as a state.

Example:
Actor 1: 30 ATK, 50 DEF
Enemy 1: 70 ATK, 30 DEF

Scenario 1:
Enemy 1 does a regular attack, making Actor 1 take 20 damage.

Scenario 2:
Enemy 1 initiates a critical hit, but Actor takes 0 damage as he / she has the passive state through an item equipped.

What script could I use to manage this effect? It'd make for a really cool accessory or armor that can negate critical damage.
Yanfly's buffs and states core should be enough.
<Custom react effect>
if (user.result().critical) value = 0
</Custom react effect>
@Poryg
For some reason, it didn't go through. The actor's still receiving critical damage.

I made a new state and used this code, and used that as a passive state notetag for general armor (accessory).
I took a look at it, it looks like there can be a bug somewhere.
Because
Spoiler: this
Screenshot_306.png
shouldn't be happening. These two things should have the same value.
What file is it under? I tried finding this under Buffs and States Core, but no luck.
That was a console report of battle action result, so you won't really find that anywhere (I just typed
<Custom React Effect>
console.log (user.result())
</Custom React Effect>
and then I did the same with <Custom Respond Effect> notetag.

However, the thing is, there is a bug somewhere. That is visible on the report. Because at first the summary says "used: true" and "physical: true", but when I expand it, I see these things are false... In other words one report tells me two different things, which it shouldn't, because it is the same report.

And that is what happens in the game, I suppose. The thing I provided is supposed to work, but for some reason it doesn't, because something completely resets the variables before the effect can happen.
Code:
<Custom React Effect>
if (target.result().critical) value = 0;
</Custom React Effect>

You need to check the result on the target and then if it's a critical, set the value to 0.
Okay, this is working. Now I can properly reference the Iron Rune from Fire Emblem to negate critical hits with this script here. I appreciate all the help.
That is weird, when I try target.critical(), nothing really happens 😀 Will have to take a look in my end then 😀

Original thread: https://forums.rpgmakerweb.com/threads/negating-critical-hits.84783/