diff --git a/src/battle_main.c b/src/battle_main.c index bd08f559c1..6a45019ff1 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5719,20 +5719,24 @@ static void TryEvolvePokemon(void) if (!(sTriedEvolving & (1u << i))) { bool32 canStopEvo = TRUE; - u32 species = GetEvolutionTargetSpecies(&gPlayerParty[i], EVO_MODE_BATTLE_SPECIAL, i, NULL, &canStopEvo, CHECK_EVO); + enum EvolutionMode mode = EVO_MODE_BATTLE_SPECIAL; + u32 evolutionItemArg = i; + u32 species = GetEvolutionTargetSpecies(&gPlayerParty[i], mode, evolutionItemArg, NULL, &canStopEvo, CHECK_EVO); sTriedEvolving |= 1u << i; if (species == SPECIES_NONE && (gLeveledUpInBattle & (1u << i))) { gLeveledUpInBattle &= ~(1u << i); - species = GetEvolutionTargetSpecies(&gPlayerParty[i], EVO_MODE_BATTLE_ONLY, gLeveledUpInBattle, NULL, &canStopEvo, CHECK_EVO); + mode = EVO_MODE_BATTLE_ONLY; + evolutionItemArg = gLeveledUpInBattle; + species = GetEvolutionTargetSpecies(&gPlayerParty[i], mode, evolutionItemArg, NULL, &canStopEvo, CHECK_EVO); } if (species != SPECIES_NONE) { FreeAllWindowBuffers(); gBattleMainFunc = WaitForEvoSceneToFinish; - GetEvolutionTargetSpecies(&gPlayerParty[i], EVO_MODE_BATTLE_ONLY, gLeveledUpInBattle, NULL, &canStopEvo, DO_EVO); + GetEvolutionTargetSpecies(&gPlayerParty[i], mode, evolutionItemArg, NULL, &canStopEvo, DO_EVO); EvolutionScene(&gPlayerParty[i], species, canStopEvo, i); return; } diff --git a/src/pokemon.c b/src/pokemon.c index eb2428f2fb..fdc49c7eda 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -4836,7 +4836,7 @@ u32 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16 case EVO_MODE_ITEM_CHECK: for (i = 0; evolutions[i].method != EVOLUTIONS_END; i++) { - bool32 conditionMet = FALSE; + bool32 conditionsMet = FALSE; if (SanitizeSpeciesId(evolutions[i].targetSpecies) == SPECIES_NONE) continue; @@ -4844,11 +4844,11 @@ u32 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16 { case EVO_ITEM: if (evolutions[i].param == evolutionItem) - conditionMet = TRUE; + conditionsMet = TRUE; break; } - if (conditionMet && DoesMonMeetAdditionalConditions(mon, evolutions[i].params, NULL, PARTY_SIZE, canStopEvo, evoState)) + if (conditionsMet && DoesMonMeetAdditionalConditions(mon, evolutions[i].params, NULL, PARTY_SIZE, canStopEvo, evoState)) { // All checks passed, so stop checking the rest of the evolutions. // This is different from vanilla where the loop continues. @@ -4870,9 +4870,9 @@ u32 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16 switch (evolutions[i].method) { - case EVO_BATTLE_END: - conditionsMet = TRUE; - break; + case EVO_BATTLE_END: + conditionsMet = TRUE; + break; } if (conditionsMet && DoesMonMeetAdditionalConditions(mon, evolutions[i].params, NULL, evolutionItem, canStopEvo, evoState)) @@ -4898,7 +4898,6 @@ u32 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16 case EVO_SPIN: if (gSpecialVar_0x8000 == evolutions[i].param) conditionsMet = TRUE; - break; }