From 35ba7b70a2cbfc884437f1fcb7a92e2a76fa55aa Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Wed, 1 May 2013 19:22:12 -0700 Subject: [PATCH] Fix crash against Substitute --- data/scripts.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/data/scripts.js b/data/scripts.js index 7e9334c0da..120e6ccdc1 100644 --- a/data/scripts.js +++ b/data/scripts.js @@ -195,9 +195,7 @@ exports.BattleScripts = { } } - if (hitResult === 0) { - target = null; - } else if (!hitResult) { + if (hitResult !== 0 && !hitResult) { if (hitResult === false) this.add('-fail', target); return false; } @@ -239,6 +237,11 @@ exports.BattleScripts = { return false; } + if (hitResult === 0) { + // substitute + target = null; + } + var damage = 0; pokemon.lastDamage = 0; if (move.multihit) {