mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
Allow Z-Moves to be selected after Mega Evolution (#3233)
* Allow Z-Moves to be selected after Mega Evolution * You cannot do Wish Mega Evolution at all if you hold a z crystal * Rebase to master
This commit is contained in:
parent
2d45b9b8fe
commit
dba28cf93f
@ -10076,19 +10076,19 @@ bool32 CanMegaEvolve(u8 battlerId)
|
|||||||
species = GetMonData(mon, MON_DATA_SPECIES);
|
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
itemId = GetMonData(mon, MON_DATA_HELD_ITEM);
|
itemId = GetMonData(mon, MON_DATA_HELD_ITEM);
|
||||||
|
|
||||||
|
#if DEBUG_BATTLE_MENU == TRUE
|
||||||
|
if (gBattleStruct->debugHoldEffects[battlerId])
|
||||||
|
holdEffect = gBattleStruct->debugHoldEffects[battlerId];
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
if (itemId == ITEM_ENIGMA_BERRY_E_READER)
|
||||||
|
holdEffect = gEnigmaBerries[battlerId].holdEffect;
|
||||||
|
else
|
||||||
|
holdEffect = ItemId_GetHoldEffect(itemId);
|
||||||
|
|
||||||
// Check if there is an entry in the evolution table for regular Mega Evolution.
|
// Check if there is an entry in the evolution table for regular Mega Evolution.
|
||||||
if (GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM) != SPECIES_NONE)
|
if (GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_ITEM) != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
#if DEBUG_BATTLE_MENU == TRUE
|
|
||||||
if (gBattleStruct->debugHoldEffects[battlerId])
|
|
||||||
holdEffect = gBattleStruct->debugHoldEffects[battlerId];
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if (itemId == ITEM_ENIGMA_BERRY_E_READER)
|
|
||||||
holdEffect = gEnigmaBerries[battlerId].holdEffect;
|
|
||||||
else
|
|
||||||
holdEffect = ItemId_GetHoldEffect(itemId);
|
|
||||||
|
|
||||||
// Can Mega Evolve via Mega Stone.
|
// Can Mega Evolve via Mega Stone.
|
||||||
if (holdEffect == HOLD_EFFECT_MEGA_STONE)
|
if (holdEffect == HOLD_EFFECT_MEGA_STONE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -10096,7 +10096,11 @@ bool32 CanMegaEvolve(u8 battlerId)
|
|||||||
|
|
||||||
// Check if there is an entry in the evolution table for Wish Mega Evolution.
|
// Check if there is an entry in the evolution table for Wish Mega Evolution.
|
||||||
if (GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE) != SPECIES_NONE)
|
if (GetBattleFormChangeTargetSpecies(battlerId, FORM_CHANGE_BATTLE_MEGA_EVOLUTION_MOVE) != SPECIES_NONE)
|
||||||
return TRUE;
|
{
|
||||||
|
// Can't Wish Mega Evolve if holding a Z Crystal.
|
||||||
|
if (holdEffect != HOLD_EFFECT_Z_CRYSTAL)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// No checks passed, the mon CAN'T mega evolve.
|
// No checks passed, the mon CAN'T mega evolve.
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -159,7 +159,6 @@ void QueueZMove(u8 battlerId, u16 baseMove)
|
|||||||
bool32 IsViableZMove(u8 battlerId, u16 move)
|
bool32 IsViableZMove(u8 battlerId, u16 move)
|
||||||
{
|
{
|
||||||
struct Pokemon *mon;
|
struct Pokemon *mon;
|
||||||
struct MegaEvolutionData *mega = &(((struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]))->mega);
|
|
||||||
u8 battlerPosition = GetBattlerPosition(battlerId);
|
u8 battlerPosition = GetBattlerPosition(battlerId);
|
||||||
u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battlerId));
|
u8 partnerPosition = GetBattlerPosition(BATTLE_PARTNER(battlerId));
|
||||||
u32 item;
|
u32 item;
|
||||||
@ -185,15 +184,6 @@ bool32 IsViableZMove(u8 battlerId, u16 move)
|
|||||||
if ((GetBattlerPosition(battlerId) == B_POSITION_PLAYER_LEFT || (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT)) && !CheckBagHasItem(ITEM_Z_POWER_RING, 1))
|
if ((GetBattlerPosition(battlerId) == B_POSITION_PLAYER_LEFT || (!(gBattleTypeFlags & BATTLE_TYPE_MULTI) && GetBattlerPosition(battlerId) == B_POSITION_PLAYER_RIGHT)) && !CheckBagHasItem(ITEM_Z_POWER_RING, 1))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (mega->alreadyEvolved[battlerPosition])
|
|
||||||
return FALSE; // Trainer has mega evolved
|
|
||||||
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
|
||||||
{
|
|
||||||
if (IsPartnerMonFromSameTrainer(battlerId) && (mega->alreadyEvolved[partnerPosition] || (mega->toEvolve & gBitTable[BATTLE_PARTNER(battlerId)])))
|
|
||||||
return FALSE; // Partner has mega evolved or is about to mega evolve
|
|
||||||
}
|
|
||||||
|
|
||||||
#if DEBUG_BATTLE_MENU == TRUE
|
#if DEBUG_BATTLE_MENU == TRUE
|
||||||
if (gBattleStruct->debugHoldEffects[battlerId])
|
if (gBattleStruct->debugHoldEffects[battlerId])
|
||||||
holdEffect = gBattleStruct->debugHoldEffects[battlerId];
|
holdEffect = gBattleStruct->debugHoldEffects[battlerId];
|
||||||
|
Loading…
Reference in New Issue
Block a user