MZ Hit accuracy?

Has anyone made a plugin improving the way HIT and EVA are managed, ie tying them together so that
100% HIT strike on a 5% EVA enemy has a 5% chance of missing
But 105% HIT on the same enemy will never miss.
Basically a system that checks HIT - EVA instead of giving no bonus for having HIT over 100%.
Visustella's core engine plugin does this. If you use it, it's under Quality of Life settings -> Accuracy Formula.
Is this kinda the equivalent of YEP for MZ?
Sorry for the double post but is there not a way to just edit it directly in the default MZ plugins?
I'd like to avoid switching to visustella for the time being.
The apply function from Game_Action in rmmz_objects.js is where the accuracy of the action being used is tested.
Code:
Game_Action.prototype.apply = function(target) {
    const result = target.result();
    this.subject().clearResult();
    result.clear();
    result.used = this.testApply(target);
    result.missed = result.used && Math.random() >= this.itemHit(target);
    result.evaded = !result.missed && Math.random() < this.itemEva(target);
    result.physical = this.isPhysical();
    result.drain = this.isDrain();
    if (result.isHit()) {
        if (this.item().damage.type > 0) {
            result.critical = Math.random() < this.itemCri(target);
            const value = this.makeDamageValue(target, result.critical);
            this.executeDamage(target, value);
        }
        for (const effect of this.item().effects) {
            this.applyItemEffect(target, effect);
        }
        this.applyItemUserEffect(target);
    }
    this.updateLastTarget(target);
};

The lines result.missed = result.used && Math.random() >= this.itemHit(target); and result.evaded = !result.missed && Math.random() < this.itemEva(target); are where it's doing the math to figure out if an attack was missed or evaded.

It starts by checking the accuracy of the skill, then, if it passes that check, it checks the evasion rate of the enemy. Both of these are random number checks, and since it checks evasion second, even if the skill has greater than 100% accuracy, there is still the chance that even a 1% evasion rate on the target could cause the skill to miss. The function a bit later on result.isHit() checks to make sure the action wasn't a miss, or an evade, or something else, before proceeding to check critical and deal damage.

The easiest way to change this is to modify how it checks the hit and evade conditions. I believe YEP's hit accuracy plugin simply subtracts the targets EVD from the subjects hit%, and never checks if an action has been evaded. You could do something like this instead to emulate it:

Code:
Game_Action.prototype.apply = function(target) {
    const result = target.result();
    this.subject().clearResult();
    result.clear();
    result.used = this.testApply(target);
    result.missed = result.used && Math.random() >= (this.itemHit(target) - this.itemEva(target));
    result.evaded = false
    result.physical = this.isPhysical();
    result.drain = this.isDrain();
    if (result.isHit()) {
        if (this.item().damage.type > 0) {
            result.critical = Math.random() < this.itemCri(target);
            const value = this.makeDamageValue(target, result.critical);
            this.executeDamage(target, value);
        }
        for (const effect of this.item().effects) {
            this.applyItemEffect(target, effect);
        }
        this.applyItemUserEffect(target);
    }
    this.updateLastTarget(target);
};
(note I haven't tested this so it might not work exactly, but this is a good starting point).

edit: the function result.isHit() has been censored because it contains the letters of a swear word. It is two words IS and HIT.
Thank you very much, not on my pc right now but I'll check it out tomorrow.
Hi again, tested it and got a Type Error

ishit.png
You can make adjustments to the itemHit and itemEva functions that are used.
I changed the itemHit from this:

return this.item().successRate * 0.01 * this.subject().hit

to this

return this.item().successRate * 0.01 * (this.subject().hit - target.eva)

For any other parameters you might want to use, just check out the list in the rpg_objects.js somewhere around line 2100.

Original thread: https://forums.rpgmakerweb.com/threads/hit-accuracy.131727/