Fix Life Orb + Emergency Exit interaction (#6738)

This commit is contained in:
fart 2020-05-25 17:14:59 -04:00 committed by GitHub
parent a4f56d27d2
commit 0450e8cb65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -285,6 +285,11 @@ export const BattleScripts: BattleScriptsData = {
if (!move.negateSecondary && !(move.hasSheerForce && pokemon.hasAbility('sheerforce'))) {
this.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move);
this.runEvent('AfterMoveSecondarySelf', pokemon, target, move);
if (pokemon && pokemon !== target && move && move.category !== 'Status') {
if (pokemon.hp <= pokemon.maxhp / 2) {
this.runEvent('EmergencyExit', pokemon, pokemon);
}
}
}
return true;

View File

@ -108,7 +108,7 @@ describe(`Emergency Exit`, function () {
assert.equal(battle.requestState, 'switch');
});
it.skip('should request switch-out after taking Life Orb recoil', function () {
it('should request switch-out after taking Life Orb recoil', function () {
battle = common.createBattle([[
{species: "Golisopod", item: "lifeorb", ability: 'emergencyexit', moves: ['peck']},
{species: "Wynaut", moves: ['sleeptalk']},