Fix crash against Substitute

This commit is contained in:
Guangcong Luo 2013-05-01 19:22:12 -07:00
parent 7ec8044b9c
commit 35ba7b70a2

View File

@ -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) {