Move-based mega evolution message for NPCs/recorded battles

This commit is contained in:
Martin Griffin 2022-12-29 22:11:13 +00:00
parent f1d97bfad7
commit cba4b78df6
3 changed files with 6 additions and 8 deletions

View File

@ -489,7 +489,6 @@ struct MegaEvolutionData
u8 battlerId;
bool8 playerSelect;
u8 triggerSpriteId;
bool8 isWishMegaEvo;
};
struct Illusion

View File

@ -4883,9 +4883,14 @@ static void CheckMegaEvolutionBeforeTurn(void)
if (gBattleStruct->mega.toEvolve & gBitTable[gActiveBattler]
&& !(gProtectStructs[gActiveBattler].noValidMoves))
{
struct Pokemon *mon;
if (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT)
mon = &gEnemyParty[gBattlerPartyIndexes[gActiveBattler]];
else
mon = &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]];
gBattleStruct->mega.toEvolve &= ~(gBitTable[gActiveBattler]);
gLastUsedItem = gBattleMons[gActiveBattler].item;
if (gBattleStruct->mega.isWishMegaEvo == TRUE)
if (GetWishMegaEvolutionSpecies(GetMonData(mon, MON_DATA_SPECIES), GetMonData(mon, MON_DATA_MOVE1), GetMonData(mon, MON_DATA_MOVE2), GetMonData(mon, MON_DATA_MOVE3), GetMonData(mon, MON_DATA_MOVE4)))
BattleScriptExecute(BattleScript_WishMegaEvolution);
else
BattleScriptExecute(BattleScript_MegaEvolution);

View File

@ -10109,18 +10109,12 @@ bool32 CanMegaEvolve(u8 battlerId)
// Can Mega Evolve via Mega Stone.
if (holdEffect == HOLD_EFFECT_MEGA_STONE)
{
gBattleStruct->mega.isWishMegaEvo = FALSE;
return TRUE;
}
}
// Check if there is an entry in the evolution table for Wish Mega Evolution.
if (GetWishMegaEvolutionSpecies(species, GetMonData(mon, MON_DATA_MOVE1), GetMonData(mon, MON_DATA_MOVE2), GetMonData(mon, MON_DATA_MOVE3), GetMonData(mon, MON_DATA_MOVE4)))
{
gBattleStruct->mega.isWishMegaEvo = TRUE;
return TRUE;
}
// No checks passed, the mon CAN'T mega evolve.
return FALSE;