From 4187c2fd54f4c61475d4f902fa0d79b5eb59e1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bastos=20Dias?= Date: Mon, 6 Oct 2025 11:13:20 +0100 Subject: [PATCH] Fix Throat Spray activation after opponent faints --- sim/battle-actions.ts | 2 ++ test/sim/items/throatspray.js | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 test/sim/items/throatspray.js diff --git a/sim/battle-actions.ts b/sim/battle-actions.ts index 1771642bbc..b32a53532a 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')); + }); +});