From aa4c28dcf3c42d39a0664a509f800d0b50cc85ed Mon Sep 17 00:00:00 2001 From: LOuroboros Date: Wed, 10 Mar 2021 08:52:43 -0300 Subject: [PATCH] Added a check for the Mega Bracelet in CanMegaEvolve --- src/battle_util.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/battle_util.c b/src/battle_util.c index af1b6c4803..7d4219dd64 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -7834,6 +7834,13 @@ bool32 CanMegaEvolve(u8 battlerId) u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battlerId)); struct MegaEvolutionData *mega = &(((struct ChooseMoveStruct*)(&gBattleResources->bufferA[gActiveBattler][4]))->mega); +#ifdef ITEM_EXPANSION + // Check if Player has a Mega Bracelet + if ((GetBattlerPosition(battlerId) == B_POSITION_PLAYER_LEFT || (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT)) + && !CheckBagHasItem(ITEM_MEGA_BRACELET, 1)) + return FALSE; +#endif + // Check if trainer already mega evolved a pokemon. if (mega->alreadyEvolved[battlerPosition]) return FALSE;