diff --git a/include/battle_controllers.h b/include/battle_controllers.h index 50e37c917c..cdc1adf79e 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -113,6 +113,7 @@ struct ChooseMoveStruct u16 species; u8 monType1; u8 monType2; + struct MegaEvolutionData mega; }; enum diff --git a/src/battle_main.c b/src/battle_main.c index 98e28ec1d7..165fa79115 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4224,6 +4224,7 @@ static void HandleTurnActionSelectionState(void) { struct ChooseMoveStruct moveInfo; + moveInfo.mega = gBattleStruct->mega; moveInfo.species = gBattleMons[gActiveBattler].species; moveInfo.monType1 = gBattleMons[gActiveBattler].type1; moveInfo.monType2 = gBattleMons[gActiveBattler].type2; diff --git a/src/battle_util.c b/src/battle_util.c index ffa409d7f3..1b90f8cd2c 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5605,14 +5605,15 @@ bool32 CanMegaEvolve(u8 battlerId) struct Pokemon *mon; u8 battlerPosition = GetBattlerPosition(battlerId); u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battlerId)); + struct MegaEvolutionData *mega = &(((struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]))->mega); // Check if trainer already mega evolved a pokemon. - if (gBattleStruct->mega.alreadyEvolved[battlerPosition]) + if (mega->alreadyEvolved[battlerPosition]) return FALSE; if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) { if (IsPartnerMonFromSameTrainer(battlerId) - && (gBattleStruct->mega.alreadyEvolved[partnerPosition] || (gBattleStruct->mega.toEvolve & gBitTable[BATTLE_PARTNER(battlerId)]))) + && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battlerId)]))) return FALSE; }