Yanfly's Hit Accuracy (YEP)

Discussion in 'Javascript/Plugin Support' started by Rigor Mortex, Aug 1, 2019.

  1. Rigor Mortex

    Rigor Mortex Mankind's Mirror Veteran

    Messages:
    58
    Likes Received:
    3
    Location:
    Dark World
    First Language:
    English
    http://www.yanfly.moe/wiki/Hit_Accuracy_(YEP)
    The plugin works as intended (as far as I can tell, anyway), other than the issue this thread is about. If a skill has a chance to inflict a State, and that skill's Hit Type is set to "Certain Hit," it will ignore any State Rate the target has (even 0%) to always inflict it; the only exception is if the target has the State Resist trait (e.g. State Resist - Poison). While a simple enough workaround would be to set State Resist where desired, doing this for Knockout causes them to become immortal due to how MV functions. As I am not a programmer, does anyone else know how to fix this? I have tested both with all my other plugins and without, and can confirm that Hit Accuracy itself is at fault.
     
    #1
  2. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,116
    Likes Received:
    690
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    The default behaviour for Certain Hit skills is to ignore the target's state rate and the mutual "luck effect". Supporting excerpt from base code:
    Code:
    Game_Action.prototype.itemEffectAddNormalState = function(target, effect) {
        var chance = effect.value1;
        if (!this.isCertainHit()) {
            chance *= target.stateRate(effect.dataId);
            chance *= this.lukEffectRate(target);
        }
        if (Math.random() < chance) {
            target.addState(effect.dataId);
            this.makeSuccess(target);
        }
    };
    Yanfly's Hit Accuracy plugin is quite simple and does not change anything with regards to states. Maybe you have an error of some kind in one of your hit rate formulae?
     
    #2
  3. Rigor Mortex

    Rigor Mortex Mankind's Mirror Veteran

    Messages:
    58
    Likes Received:
    3
    Location:
    Dark World
    First Language:
    English
    The hit formulae in the plugin are unchanged from the default. Turning every plugin off and doing a test battle, I can confirm that a Certain Hit skill will still ignore State Rate. That is incredibly unfortunate.
     
    #3
  4. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,116
    Likes Received:
    690
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    You could try saving this as a .js file and importing as a plugin:
    Code:
    Game_Action.prototype.itemEffectAddNormalState = function(target, effect) {
        var chance = effect.value1;
        chance *= target.stateRate(effect.dataId);
        chance *= this.lukEffectRate(target);
        if (Math.random() < chance) {
            target.addState(effect.dataId);
            this.makeSuccess(target);
        }
    };
    Basically, this just removes the "if not Certain Hit" part so that all states will check for the target's state rate. This is an override, so you may want to put it near the top of your Plugin Manager load order. I think that'll account for all "state add via skill" situations, but haven't tested. :kaoswt:
     
    #4
  5. bgillisp

    bgillisp Global Moderators Global Mod

    Messages:
    11,898
    Likes Received:
    12,017
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    RMVXA
    This is actually not a bug, as certain hit is meant to mean certain, as in, always works. That is why states ignore the resistance in that skill. The best way to fix it is to change your skill to a physical or magical skill instead.
     
    #5
    caethyril likes this.

Share This Page