Changing the way escape chance is evaluated

Hi, I'd like a small change that I am hoping is only a matter of adding or changing a few lines of code.


Instead of comparing the troop's average agility to the party's average agility, I would like to compare the enemy in the troop with HIGHEST agility, to the active party member with the LOWEST agility.


Basically to represent a more "can your slowest actor outrun the fastest enemy?" kind of thing.  Thanks in advance!
Hi Jon,


I haven't tested this out (let me know what happens), but I think this will do it for you.


Game_Unit.prototype.highest_agility = function() {
    return Math.max.apply(null, this.aliveMembers().map(function(actor) {
        return actor.agi;
    }));
};
Game_Unit.prototype.lowest_agility = function() {
    return Math.min.apply(null, this.aliveMembers().map(function(actor) {
        return actor.agi;
    }));
};
BattleManager.makeEscapeRatio = function() {
    this._escapeRatio = 1.0 * $gameParty.lowest_agility() / $gameTroop.highest_agility();
};




The first two methods define "highest_agility" and "lowest_agility" for units (party or troop), and the final method uses those new methods to rewrite the escape ratio to your liking.  With the current formula, if your party's lowest-AGI alive member is faster than the troop's highest-AGI alive member, you will have a 100% chance to escape.  If your slowest member has 75% the AGI of the enemy's fastest member, you have a 75% chance to escape, and so on.  You can change the 1.0 (higher = easier to escape) if you'd like.


Just copy this into a .js file and insert it to your project as a plugin (or add it to an existing plugin).  Since I haven't tried this out yet, it's possible it will error.  If that's the case, let me know the message and I'll adjust.

Original thread: https://forums.rpgmakerweb.com/threads/changing-the-way-escape-chance-is-evaluated.73383/