ICF-Soft Stat affecting Variance

VillainFan42

Fan of Villains
Veteran
Joined
Feb 11, 2013
Messages
99
Reaction score
16
First Language
English
Primarily Uses
RMMV
This is a bit hard to explain, and this isn't overly critical, but bear with me, okay?

I'm using a plugin by ICF-Soft allowing me to implement custom parameters. The two stats- Skill and Intellect- have effects on other things, but I want to add one more, subtle effect to both of them. I want them to slowly move the bottom threshold of the variance up- Skill for Physical attacks, Intellect for Magical attacks.

Here's what I mean.

At level 10, let's say the main physical attacker, after calculating the damage formula, has a damage range between 172 and 259. However, he has a Skill stat of 11. As it is now, Skill is only used to increase Accuracy (read: Hit Rate) as well as the power of most physical skills that cost TP.

What I want to do is raise the lower threshold of variance by a percentage equal to the Skill stat. So, if this were implemented, the lowest the attack could be would be raised 11% from 172 to 181.

That doesn't seem like much, but in the endgame, with damage reaching the 4000s and Skill also being much higher, this would make damage a lot more consistent. I want Intellect (which currently determined Item potency and the extra damage you do with elemental weaknesses) to do basically the same thing, but for magic. That's kind of what I want Skill and Intellect to be- negligible in the early stages of the game, incredibly important in the endgame.
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
147
Reaction score
166
First Language
Danish
Primarily Uses
RMMV
I used more time on this than I thought I would. You might be able to find a more elegant solution than this. I do not really know exactly how ICE-Soft Param Core works but I did my best.

I hardcoded that the "Skill" or "Intellect" affects the variance by a 1 to 1 ration. I assumed these were NParams, if not tell me or this will not work.

You need to set the parameters of this plugin to correspond with the index of "Skill" and "Intellect" respectively.

Code:
//=============================================================================
// Decrease Variance Damage
// MRP_DecreaseVarianceDamage.js
// By Magnus0808 || Magnus Rubin Peterson
//=============================================================================

/*:
 * @plugindesc Extension to ICFSoft_ParamsCore
 * @author Magnus0808
 *
 * @help This plugin needs ICFSoft_ParamsCore to work.
 * Set the parameters to indicate the index of the NParam that is used to
 * affect the variance.
 * If the value of the NParam is 1 then it will remove 1% of the variance from
 * the minimum damage. So if it is 100 then you will always deal max damage.
 *
 * @param Physical NParam Index
 * @type Number
 * @desc The index of the NParam with the parameter that affect the variance
 * of physcial dmg.
 *
 * @param Magical NParam Index
 * @type Number
 * @desc The index of the NParam with the parameter that affect the variance
 * of magical dmg.
 *
 */

(function(){
    
    DecreaseVarianceDamage = {};
    DecreaseVarianceDamage.Parameters = PluginManager.parameters('MRP_DecreaseVarianceDamage');
    DecreaseVarianceDamage.physicalIndex = Number(DecreaseVarianceDamage.Parameters['Physical NParam Index']);
    DecreaseVarianceDamage.magicIndex = Number(DecreaseVarianceDamage.Parameters['Magical NParam Index']);
    
    Game_Action.prototype.applyVariance = function(damage, variance) {
        var amp = Math.max(Math.abs(damage) * variance / 100, 0);
        var gVariance = 0;

        if(this.isPhysical() && this.isMagical){
            gVariance =  (this.subject().NParam(DecreaseVarianceDamage.physicalIndex)/100 + this.subject().NParam(DecreaseVarianceDamage.magicIndex)/100)/2;
        } else if(this.isPhysical()){
            gVariance =  this.subject().NParam(DecreaseVarianceDamage.physicalIndex)/100;
        } else if (this.isMagical){
            gVariance = this.subject().NParam(DecreaseVarianceDamage.magicIndex)/100;
        }
        if(gVariance > 1) gVariance = 1;
        
        var gAmp = amp * gVariance;           
        amp = Math.floor(amp - gAmp);
        gAmp = Math.floor(gAmp);
        
        var v = Math.randomInt(amp + 1) + Math.randomInt(amp + 1) - amp;
        return damage >= 0 ? damage + v + gAmp : damage - v - gAmp;
    };
    
})();
 

Attachments

VillainFan42

Fan of Villains
Veteran
Joined
Feb 11, 2013
Messages
99
Reaction score
16
First Language
English
Primarily Uses
RMMV
I used more time on this than I thought I would. You might be able to find a more elegant solution than this. I do not really know exactly how ICE-Soft Param Core works but I did my best.

I hardcoded that the "Skill" or "Intellect" affects the variance by a 1 to 1 ration. I assumed these were NParams, if not tell me or this will not work.

You need to set the parameters of this plugin to correspond with the index of "Skill" and "Intellect" respectively.

Code:
//=============================================================================
// Decrease Variance Damage
// MRP_DecreaseVarianceDamage.js
// By Magnus0808 || Magnus Rubin Peterson
//=============================================================================

/*:
 * @plugindesc Extension to ICFSoft_ParamsCore
 * @author Magnus0808
 *
 * @help This plugin needs ICFSoft_ParamsCore to work.
 * Set the parameters to indicate the index of the NParam that is used to
 * affect the variance.
 * If the value of the NParam is 1 then it will remove 1% of the variance from
 * the minimum damage. So if it is 100 then you will always deal max damage.
 *
 * @param Physical NParam Index
 * @type Number
 * @desc The index of the NParam with the parameter that affect the variance
 * of physcial dmg.
 *
 * @param Magical NParam Index
 * @type Number
 * @desc The index of the NParam with the parameter that affect the variance
 * of magical dmg.
 *
 */

(function(){
   
    DecreaseVarianceDamage = {};
    DecreaseVarianceDamage.Parameters = PluginManager.parameters('MRP_DecreaseVarianceDamage');
    DecreaseVarianceDamage.physicalIndex = Number(DecreaseVarianceDamage.Parameters['Physical NParam Index']);
    DecreaseVarianceDamage.magicIndex = Number(DecreaseVarianceDamage.Parameters['Magical NParam Index']);
   
    Game_Action.prototype.applyVariance = function(damage, variance) {
        var amp = Math.max(Math.abs(damage) * variance / 100, 0);
        var gVariance = 0;

        if(this.isPhysical() && this.isMagical){
            gVariance =  (this.subject().NParam(DecreaseVarianceDamage.physicalIndex)/100 + this.subject().NParam(DecreaseVarianceDamage.magicIndex)/100)/2;
        } else if(this.isPhysical()){
            gVariance =  this.subject().NParam(DecreaseVarianceDamage.physicalIndex)/100;
        } else if (this.isMagical){
            gVariance = this.subject().NParam(DecreaseVarianceDamage.magicIndex)/100;
        }
        if(gVariance > 1) gVariance = 1;
       
        var gAmp = amp * gVariance;          
        amp = Math.floor(amp - gAmp);
        gAmp = Math.floor(gAmp);
       
        var v = Math.randomInt(amp + 1) + Math.randomInt(amp + 1) - amp;
        return damage >= 0 ? damage + v + gAmp : damage - v - gAmp;
    };
   
})();
Sorry I didn't get back to you for a while, but thank you so much for the help!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Don't forget, aspiring writers: Personality isn't what your characters do, it is WHY they do it.
Hello! I would like to know if there are any pluggings or any way to customize how battles look?
I was thinking that when you start the battle for it to appear the eyes of your characters and opponents sorta like Ace Attorney.
Sadly I don't know how that would be possible so I would be needing help! If you can help me in any way I would really apreciate it!
The biggest debate we need to complete on which is better, Waffles or Pancakes?
rux
How is it going? :D
Day 9 of giveaways! 8 prizes today :D

Forum statistics

Threads
106,051
Messages
1,018,551
Members
137,837
Latest member
Dabi
Top