diff --git a/sim/battle-actions.ts b/sim/battle-actions.ts index 66fd617e6d..5458a55961 100644 --- a/sim/battle-actions.ts +++ b/sim/battle-actions.ts @@ -528,6 +528,8 @@ export class BattleActions { return false; } + if (this.battle.faintMessages(false, true)) return true; + if (!(move.hasSheerForce && pokemon.hasAbility('sheerforce')) && !move.flags['futuremove']) { const originalHp = pokemon.hp; this.battle.singleEvent('AfterMoveSecondarySelf', move, null, pokemon, target, move); diff --git a/test/sim/items/throatspray.js b/test/sim/items/throatspray.js new file mode 100644 index 0000000000..158a68534c --- /dev/null +++ b/test/sim/items/throatspray.js @@ -0,0 +1,22 @@ +'use strict'; + +const assert = require('./../../assert'); +const common = require('./../../common'); + +let battle; + +describe('Throat Spray', () => { + afterEach(() => { + battle.destroy(); + }); + + it(`should not activate if the last opponent fainted`, () => { + battle = common.createBattle([[ + { species: 'kommoo', item: 'throatspray', moves: ['clangingscales'] }, + ], [ + { species: 'roggenrola', level: 1, moves: ['sleeptalk'] }, + ]]); + battle.makeChoices(); + assert.false(battle.getDebugLog().includes('-enditem')); + }); +});