MZ Substitute's Odd Quirks (SOLVED)

Natively, you can set Substitute (Cover) via a special flag on actors, classes or equipment. Ive noticed two odd things:
  1. It still triggers when under restrictive status ailment(s).
  2. It works on single target magical skills.

Is there a way around those? I could add it as a status, I suppose. Id rather have it native to some specific actor(s). That way it would always be "ON." For magic, I can sort of understand the logic. More of a gray area. Thanks! Please nothing V.Stella.
It still triggers when under restrictive status ailment(s).
ones that prevent the actor from being able to act like a paralysis does prevent it, but the other restrictions dont. try this
Code:
Game_BattlerBase.prototype.isSubstitute = function () {
    return this.specialFlag(Game_BattlerBase.FLAG_ID_SUBSTITUTE) && this.restriction() === 0;
};

It works on single target magical skills.
Is it not supposed to? my experience is that games with covers either have it work on both phys and mag skills or had different covers that had their own specific conditions.

Is it supposed to work only on all phys skills and only AoE magic? not on magic at all? only AoE skills? Cause the only restrictions are normally that the skill isnt certain hit and the substituter isnt at low hp. even single target phys skills get substituted, so im not sure where the distinction for single target magic is being drawn.
My choice of word was poor. You're right, I should have distinguished between a soft and hard restriction. It natively disables it but ONLY if the status is labeled "cant move." I had "Sadly does not disable Substitute/Cover." written down under the confusion status's note box. Well, it feels more appropriate to cover for single-target physical attacks only (my bias). Most games Ive played featuring that ability had it unable to take a spell's hit for an ally.

Ive tested your plugin, and it works! Thank you so much. <3 You people always amaze me. Ill write your name in the plugin's credits as a reminder, in the case I make it to the end.
Well, it feels more appropriate to cover for single-target physical attacks only
so with that in mind, try adding this to the plugin above
Code:
BattleManager.checkSubstitute = function(target) {
    return target.isDying() && this._action.isPhysical() && this._action.isForOne();
};
it should make it it so that substitutes only block single target physical hits
I can confirm your second addition working. Bless you! <3 I'll mark the topic as resolved.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/substitutes-odd-quirks-solved.183330/