Skip to content

Commit

Permalink
Gens 1 & 2: Make sure residuals are not executed after target faint
Browse files Browse the repository at this point in the history
  • Loading branch information
Joimer committed Jan 8, 2015
1 parent 3b9041f commit f60a251
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion mods/gen1/scripts.js
Expand Up @@ -165,7 +165,6 @@ exports.BattleScripts = {
}
this.useMove(move, pokemon, target, sourceEffect);
this.runEvent('AfterMove', target, pokemon, move);
this.runEvent('AfterMoveSelf', pokemon, target, move);

// If rival fainted
if (target.hp <= 0) {
Expand All @@ -174,6 +173,8 @@ exports.BattleScripts = {
// We remove screens
target.side.removeSideCondition('reflect');
target.side.removeSideCondition('lightscreen');
} else {
this.runEvent('AfterMoveSelf', pokemon, target, move);
}

// For partial trapping moves, we are saving the target
Expand Down
2 changes: 1 addition & 1 deletion mods/gen2/scripts.js
Expand Up @@ -103,7 +103,7 @@ exports.BattleScripts = {
pokemon.moveUsed(move);
this.useMove(move, pokemon, target, sourceEffect);
this.runEvent('AfterMove', target, pokemon, move);
if (!move.selfSwitch) this.runEvent('AfterMoveSelf', pokemon, target, move);
if (!move.selfSwitch && target.hp > 0) this.runEvent('AfterMoveSelf', pokemon, target, move);
},
moveHit: function (target, pokemon, move, moveData, isSecondary, isSelf) {
var damage;
Expand Down

0 comments on commit f60a251

Please sign in to comment.