From 1aedf0ee719ea67c0047ca17c35eba3e51bc338c Mon Sep 17 00:00:00 2001 From: Joimer Date: Mon, 29 Dec 2014 02:27:39 +0100 Subject: [PATCH] Gens 1 & 2: Fix bug with substitute on <25% hp An improper check caused damage on substitutes when the user had <=25%hp to be lowered. --- mods/gen1/scripts.js | 2 +- mods/gen2/scripts.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/gen1/scripts.js b/mods/gen1/scripts.js index 7ecee09c2d..eae61e8333 100644 --- a/mods/gen1/scripts.js +++ b/mods/gen1/scripts.js @@ -777,7 +777,7 @@ exports.BattleScripts = { if (damage > 1) { damage *= this.random(217, 256); damage = Math.floor(damage / 255); - if (damage > target.hp) damage = target.hp; + if (damage > target.hp && !target.volatiles['substitute']) damage = target.hp; } // We are done, this is the final damage. diff --git a/mods/gen2/scripts.js b/mods/gen2/scripts.js index b726447825..0e025f1819 100644 --- a/mods/gen2/scripts.js +++ b/mods/gen2/scripts.js @@ -449,7 +449,7 @@ exports.BattleScripts = { if (damage > 1) { damage *= this.random(217, 256); damage = Math.floor(damage / 255); - if (damage > target.hp) damage = target.hp; + if (damage > target.hp && !target.volatiles['substitute']) damage = target.hp; } // If damage is less than 1, we return 1