[RMMV] Magic Hit Rate

Hello everyone.

I'd like to make the Hit Rate of characters affect both physical attacks and magical attacks

basically:

Magic Attack Hit rate: user.hit - target.mev (or rather user.hit * (1 - target.mev)
Physical Attack Hit rate. user.hit - target.eva (or rather user.hit * (1 - target.eva)

As I understand, by default, all magic attacks have a 100% hit rate which gets reduced by magical evasion but is unaffected by the users hitrate.
Because if you're blinded, why would you miss with a bow and arrow but not with a fireball which you have to aim aswell?

So far I have only found VX scripts for this but none for MV.
you'll need a plugin to change hit calculations.
yanfly has a hit accuracy one, if I recall right, not sure if anyone else did one yet.
I don't know if you could do this with yanfly's hit accuracy plugin.
And even so you can't even purchase this plugin right now and I don't want to spend 10 bucks for a single plugin.

Since in an old thread the same problem was solved for VX (here), I though it may not be too difficult in MV either.
I'm almost sure it was it. One of his plugins let you set how hit chance is calculated, physical skills using hit and magical skills using 1.
Unfortunately, if you don't want to use yanfly's you'll have to hunt down a substitute. While his plugins were free people were kinda "yanfly already covered this, no need to make a new one, better just expand it or make something else".
Which kinda gave everyone else a problem when he paywalled them years later.
Basically, you just need to modify this function in rpg_objects.js:

JavaScript:
Game_Action.prototype.itemHit = function(target) {
    if (this.isPhysical()) {
        return this.item().successRate * 0.01 * this.subject().hit;
    } else {
        return this.item().successRate * 0.01;
    }
};

So if you paste the following code into a plugin (ideally one included high in your plugin list) or replacing the function in rpg_objects.js, it will give the formula you mentioned.

Magic Attack Hit rate: user.hit - target.mev (or rather user.hit * (1 - target.mev)
Physical Attack Hit rate. user.hit - target.eva (or rather user.hit * (1 - target.eva)
JavaScript:
Game_Action.prototype.itemHit = function(target) {
    if (this.isPhysical()) {
        return this.item().successRate * 0.01 * this.subject().hit * (1 - target.eva);
    } else {
        return this.item().successRate * 0.01 * this.subject().hit * (1 - target.mev);
    }
};
Hmm... yes that's a great start I believe. It does function properly.
However this seems to deactivate the "evade" motion trigger for magic evasion.

If I miss an enemy with magic it just states that the action failed and not that the attack missed.
As a result there is no evasion sound or battler motion. But this is still better than before.
Yeah, that just changes the calculation. It's not really a plugin, just a starting point for what you want.

Original thread: https://forums.rpgmakerweb.com/threads/rmmv-magic-hit-rate.123347/