じ☆ve冰风 发表于 6 天前

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: / 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);
                            }
                        };                
Click to expand...


        The important line is

                                chance *= target.stateRate(effect.dataId);                
Click to expand...


        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.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


                        }                
Click to expand...


        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.meta.good){} else {chance *= this.lukEffectRate(target);
                        }                
Click to expand...


        Hope I could help you!


本贴来自国际rpgmaker官方论坛作者:Silverskin处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/ignoring-luk-luck-on-positive-states.66083/
页: [1]
查看完整版本: Ignoring Luk (Luck) on positive states!