From e979fc6666bca9fefa3a03ce441d04ccd835e6b5 Mon Sep 17 00:00:00 2001 From: The Immortal Date: Sat, 19 Sep 2015 23:45:10 +0400 Subject: [PATCH] Fix max speed in opponent tooltip --- js/client-battle.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/client-battle.js b/js/client-battle.js index b6b6b2cba..661d543cd 100644 --- a/js/client-battle.js +++ b/js/client-battle.js @@ -1202,13 +1202,14 @@ }, // Functions to calculate speed ranges of an opponent. getTemplateMinSpeed: function (template, level) { - var nature = (this.battle.gen < 3 || this.battle.tier === 'Random Battle') ? 1 : 0.9; + var nature = (this.battle.tier === 'Random Battle' || this.battle.gen < 3) ? 1 : 0.9; return Math.floor(Math.floor(2 * template.baseStats['spe'] * level / 100 + 5) * nature); }, getTemplateMaxSpeed: function (template, level) { - var nature = (this.battle.gen < 3 || this.battle.tier === 'Random Battle') ? 1 : 1.1; - var maxIvs = (this.battle.gen > 2) ? 31 : 30; - return Math.floor(Math.floor(Math.floor(2 * template.baseStats['spe'] + maxIvs + 63) * level / 100 + 5) * nature); + var iv = (this.battle.gen < 3) ? 30 : 31; + var value = iv + (this.battle.tier === 'Random Battle' ? 21 : 63); + var nature = (this.battle.tier === 'Random Battle' || this.battle.gen < 3) ? 1 : 1.1; + return maxSpe = Math.floor(Math.floor(Math.floor(2 * template.baseStats['spe'] + value) * level / 100 + 5) * nature); }, // Gets the proper current type for moves with a variable type. getMoveType: function(move, pokemon) {