Ignoring Luk (Luck) on positive states!

Hey everyone, 


I have been messing around with the "Luck" (LuK) parameter, and apparently, having a high amount of luck also nullifies the probability of positive states, such as hp regen.


Especially if you use custom evaluation codes, such as yanflys lunatic state effects, luck has not the wished effect.


FIX:


Change the games source code.


Go to: [Game Folder]/ js/ rpg_objects.js


Open the file and search for "luk". (Strg+F)


You should find this:

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);
    }
};

The important line is

        chance *= target.stateRate(effect.dataId);

Unfortunately, RPG Maker calculates the luck rate when afflicting ANY state.


To change this, insert an if bracket that checks a notetag in the state notebox.

var stateId = effect.dataId; //variable for the respective state id that is checked


if ($dataStates[stateId].meta.good)  //meta means the notetag, "good" is the notetag for positive states that arent afflicted by luk ==> <good>


{


//don't calculate anything


}


else {


chance *= target.stateRate(effect.dataId);  //calculate the normal luck rate on negative states


}

Be aware to check if any plugins edit the source code. I use a lot of Yanfly's scripts, and I edited "BattleEngineCore".


Simply search for this line and edit it like I have done.

Game_Action.prototype.itemEffectAddNormalState = function(target, effect) {
    var stateId = effect.dataId;
    var chance = effect.value1;
    if (!this.isCertainHit()) {
      chance *= target.stateRate(stateId);
      if ($dataStates[stateId].meta.good){} else {chance *= this.lukEffectRate(target);
}

Hope I could help you!
To be frank, when information is so pivotal (and scarce) like this I don't care about necro. Need to tap every source possible. Hope you're still out there.

This situation (RPG Maker uses luck against healing) was one of the first things that made me realize this engine was... well... special. *ahem*

So here is my question, does your amazing script here ignore both the caster and recipients LUK? It's my understanding that a recipient with good luk might not receive the heal just as much as a caster with bad luck may have trouble performing the heal.

Original thread: https://forums.rpgmakerweb.com/threads/ignoring-luk-luck-on-positive-states.66083/