Merge pull request #1419 from LOuroboros/mega_bracelet

Added a check for the Mega Bracelet in CanMegaEvolve
This commit is contained in:
ExpoSeed 2021-04-04 15:06:40 -05:00 committed by GitHub
commit df900ca310
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8038,6 +8038,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;