From 0a2078a6a93a35161e33ddbffabd1bece14eb6e9 Mon Sep 17 00:00:00 2001 From: David Stone Date: Mon, 13 May 2024 15:49:01 -0600 Subject: [PATCH] Ensure the member function `switch_in` sets the Pokemon to a valid state before it passes itself to a free function. --- source/tm/pokemon/active_pokemon.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/tm/pokemon/active_pokemon.cpp b/source/tm/pokemon/active_pokemon.cpp index 03448bc8..2c852175 100644 --- a/source/tm/pokemon/active_pokemon.cpp +++ b/source/tm/pokemon/active_pokemon.cpp @@ -813,12 +813,12 @@ struct AnyMutableActivePokemon : ActivePokemonImpl { this->m_pokemon.set_status(StatusName::poison); } this->m_flags.status.set(this->m_pokemon.status().name()); - if (this->item(environment) == Item::Berserk_Gene) { - activate_berserk_gene(*this, environment); - } if (!replacing_fainted_or_initial_switch) { this->m_flags.last_used_move.use_switch(); } + if (this->item(environment) == Item::Berserk_Gene) { + activate_berserk_gene(*this, environment); + } } constexpr auto switch_out() const -> void {