Fix crash when ability is reactivated for a pokemon off the field

This commit is contained in:
Dean 2025-03-03 21:34:15 -08:00
parent 6181afc6d2
commit 52da7e1050

View File

@ -1243,7 +1243,7 @@ export class SuppressAbilitiesTag extends ArenaTag {
if (pokemon) {
globalScene.queueMessage(i18next.t("arenaTag:neutralizingGasOnAdd", { pokemonNameWithAffix: getPokemonNameWithAffix(pokemon) }));
for (const fieldPokemon of globalScene.getField()) {
for (const fieldPokemon of globalScene.getField(true)) {
if (fieldPokemon && fieldPokemon.id !== pokemon.id) {
[ true, false ].forEach((passive) => applyOnLoseAbAttrs(fieldPokemon, passive));
}
@ -1274,7 +1274,7 @@ export class SuppressAbilitiesTag extends ArenaTag {
globalScene.queueMessage(i18next.t("arenaTag:neutralizingGasOnRemove"));
}
for (const pokemon of globalScene.getField()) {
for (const pokemon of globalScene.getField(true)) {
// There is only one pokemon with this attr on the field on removal, so its abilities are already active
if (pokemon && !pokemon.hasAbilityWithAttr(PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr, false)) {
[ true, false ].forEach((passive) => applyOnGainAbAttrs(pokemon, passive));